Chapter    8

Managing What Happens When

So far in this book, you’ve made things happen in a fairly regular manner. You send a message to an object, the method corresponding to that message selector runs and then returns, and your code continues. This only scratches the surface of what’s possible with Objective-C and Cocoa Touch; you can run code later, run two pieces of code at the same time, or run nothing at all until something else happens. In this chapter, we’ll discuss the specifics of how you manage when your code runs, as well as delving into why it matters. We’ll cover writing code to take advantage of the latest multicore processors, using timers to repeat the execution of code over time, and run loops, Apple’s efficient way to wait ...

Get Learn Cocoa Touch for iOS 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.