They have no other way to send a message to an object, but this is the only way. For example, in [myView setValue:@"foo"] , setValue: is a selector. (Another, less convenient way to write the same thing: objc_msgSend(myView, @selector(setValue:), @"foo") .)
As Jan Henry says, you can use SEL values ββto select a selector at runtime instead of compile time. This is the fundamental method in Cocoa; user interfaces usually connect to controllers using target / action bindings, where the target is the object and the action is the selector. Usually you install this at the tip, but you can also do this in code:
[myButton setTarget:myController]; [myButton setAction:@selector(buttonClicked:)];
Jens ayton
source share