How to use a Selector

Just a quick reminder before I forget (again) how selectors are called:

Some of Apple’s pre-written methods use whats known as a Selector. Here’s an example method that uses a selector:

Notice how the selector is created on the second line. All it wants to know here is the method name really. Imagine you had a method called myMethod in the current class (hence the use of self here), this is how it gets called via the action parameter.

If you were to call this method just by itself, you’d use the usual

For more information and how to build your own selectors, check out the Cocoa Core Competencies section on Selectors.

About Jay Versluis

Jay is a medical miracle known as Super Survivor. He runs two YouTube channels, five websites and several podcast feeds. To see what else he's up to, and to support him on his mission to make the world a better place, check out his Patreon Campaign.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.