Chapter 6. While Your Application Is Running

In This Chapter

  • Seeing how applications actually work

  • Getting a handle on how nib files work

  • Following what goes on when the user taps your application icon

  • Managing events

  • Creating an app with a view

  • Remembering memory management

  • Knowing what else you should be aware of at runtime

Taking a peek at the iPhone application architecture (Chapter 2) and working through the steps of creating the user interface for an application (Chapter 5) are all fine and dandy, but at some point, you have to add some code — and to do that, you need an additional frame of reference: You need to know how all this stuff works at runtime.

Uncovering the mysteries of runtime is the goal of this chapter.

Okay, if you can't wait to code, then by all means skip to the next chapter. Honestly, if I were you (or me without benefit of hindsight), I'd be itching to do the same thing. But you'll probably run into trouble, just as I did, if you don't take some time beforehand to examine how the objects work together to deliver the user's experience of the application.

Application Anatomy 101 — The Life Cycle

The short-but-happy life of an application begins when a user launches it by tapping its icon on the Home screen. The system launches your application by calling its main function.

The main function does only three things:

  • Sets up an autorelease pool.

  • Calls the UIApplicationMain function.

  • At termination, releases the autorelease pool.

To be honest, this whole main function thing is ...

Get iPhone® Application Development For Dummies®, 2nd Edition 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.