In Objective C, a
Selector is a run-time value of type
SEL (see
SEL) that serves as a kind of an identification number for a
method. The run-time system is responsible for ensuring that each method that could be called has a
unique and
nonzero selector, and the
Objective C messaging system, while it is trying to figure out what to do with a method call, uses these selectors to refer to methods.
The @selector( methodname ) directive will return the selector of methodname. Methodname should be given name only-- for example '- thingWithWidth:(int)w AndName: (NSString)bdf AndOtherThing: ktru' would be reduced to just @selector( thingWithWidth:AndName:AndOtherThing: ).
Uses for the resulting product include the (BOOL)respondsToSelector:(SEL)selector method-- which, as part of NSObject is supported by literally every objective c object-- and calling objc_msgSend() by hand, if for some completely bizarre reason you absolutely HAVE to do that. Keep in mind, though, that in any situation you might be tempted to call objc_msgSend() by hand, you would be better off using the PerformSelector: method (which is also inherited from NSObject) instead.