Chapter 9. Understanding the UIApplicationDelegate
In This Chapter
Learning the ins and outs of the UIApplicationDelegate |
Handling startup and shutdown of your application |
Receiving memory warnings and status information |
Taking action to respond to notifications |
Receiving network notifications and handling opened URLs |
Thus far, every application that you've written has contained an application delegate class. Typically, these are generated by the template that you use to create the project in the first place. Therefore, it's logical that I should take a moment and discuss the application delegate and what it does for you.
I won't go into tremendous amounts of detail in this chapter; the goal here is to become familiar with the architecture and some of the messages that the UIApplicationDelegate
can receive.
Exploring the Purpose of the UIApplicationDelegate
Every application written for the iPhone has an application delegate. In some ways, you can think of the application delegate as your main class for your application. It's the first place that your application is handed control from the operating system when it's launched, and it is also the last place that the application executes from as it is exiting. This makes it the perfect place to handle tasks such as loading and saving of persistent state. In addition to this, it also handles certain operating system messages that are sent to the application as it is running. These include handling memory warnings, or changes in the size of the ...
Get Cocoa Touch™ for iPhone® OS 3 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.