One Quickie


Seeing the selectors objects ask you about (NSObject->General)
Sometimes it's handy to see when someone is asking your object what selectors it reponds to. Stick this in your class and you can see what folks are asking for:
- (BOOL) respondsToSelector: (SEL) aSelector
{
    NSLog (@"%s", (char *) aSelector);
    return ([super respondsToSelector: aSelector]);

} // respondsToSelector
This takes advantage of an implementation detail where the SEL is actually a pointer to a C string



borkware home | products | miniblog | rants | quickies | cocoaheads
Advanced Mac OS X Programming book

webmonster@borkware.com