27 Callbacks

Thus far, your code has been the boss. It has been sending messages to standard Foundation objects, like instances of NSString and NSArray, and telling them what to do. When your code has finished executing, the program ends.

In this chapter, you are going to create a program that does not just start, execute, and end. Instead, this program is event-driven. It will start and wait for an event. When that event happens, the program will execute code in response. This program will not end by itself; it will keep sitting and waiting for the next event until you tell it to stop.

The events that can happen on a Mac or an iOS device are many and varied. Here are a few examples: the user clicks the mouse or taps a button, ...

Get Objective-C Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.