In
Objective-C, selector has two meanings. It can be used to refer simply to the
name of a method when it’s used in a source-code message to an object. It also,
though, refers to the unique identifier that replaces the name when the source
code is compiled. Compiled selectors are of type SEL. All methods with the same
name have the same selector. You can use a selector to invoke a method on an
object—this provides the basis for the implementation of the target-action
design pattern in Cocoa.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
In Objective-C, selector has two meanings. It can be used to refer simply to the name of a method when it’s used in a source-code message to an object. It also, though, refers to the unique identifier that replaces the name when the source code is compiled. Compiled selectors are of type SEL. All methods with the same name have the same selector. You can use a selector to invoke a method on an object—this provides the basis for the implementation of the target-action design pattern in Cocoa.
[myColor performSelector:@selector(setColor:) withObject:green];
is equivalent to:
[myColor setColor:green];