Memory management policies, such as how top-level objects are managed when a nib
loads, are simplified and clarified. And so on.
At the same time, Cocoa Touch is still a form of Cocoa. It still requires a knowledge of
Objective-C. It is not a scripting language; it is certainly not aimed at nonprogrammers,
like HyperCard’s HyperTalk or Apple’s AppleScript. It is still huge and complicated.
In fact, it’s rather difficult.
Meanwhile, Cocoa Touch itself evolves and changes. The iPhone System 2 matured
into the iPhone System 3. Then there was a sudden sally in a new direction when the
iPad introduced a larger screen and iPhone System 3.2. The iPhone 4 and its double-
resolution Retina display also ran on a major system increment, now dubbed iOS 4.
Every one of these changes has brought new complexities for the programmer to deal
with. To give just one simple example, users rightly complained that switching between
apps on the iPhone meant quitting one app and launching another. So Apple gave the
iPhone 4 the power of multitasking; the user can switch away from an app and then
return to it later to find it still running and in the state it was left previously. All well
and good, but now programmers must scurry to make their apps compatible with mul-
titasking, which is not at all trivial.
The popularity of the iPhone, with its largely free or very inexpensive apps, and the
subsequent popularity of the iPad, have brought and will continue to bring into the
fold many new programmers who see programming for these devices as worthwhile
and doable, even though they may not have felt the same way about Mac OS X. Apple’s
own annual WWDC developer conventions have reflected this trend, with their em-
phasis shifted from Mac OS X to iOS instruction.
The widespread eagerness to program iOS, however, though delightful on the one
hand, has also fostered a certain tendency to try to run without first learning to walk.
iOS gives the programmer mighty powers that can seem as limitless as imagination
itself, but it also has fundamentals. I often see questions online from programmers who
are evidently deep into the creation of some interesting app, but who are stymied in a
way that reveals quite clearly that they are unfamiliar with the basics of the very world
in which they are so happily cavorting.
It is this state of affairs that has motivated me to write this book, which is intended to
ground the reader in the fundamentals of iOS. I love Cocoa and have long wished to
write about it, but it is iOS and its popularity that has given me a proximate excuse to
do so. Indeed, my working title was “Fundamentals of Cocoa Touch Programming.”
Here I have attempted to marshal and expound, in what I hope is a pedagogically helpful
and instructive yet ruthlessly Euclidean and logical order, the principles on which
sound iOS programming rests, including a good basic knowledge of Objective-C (start-
ing with C itself) and the nature of object-oriented programming, advice on the use of
the tools, the full story on how Cocoa objects are instantiated, referred to, put in com-
munication with one another, and managed over their lifetimes, and a survey of the
primary interface widgets and other common tasks. My hope, as with my previous
xviii | Preface