Chapter 7. View Controllers

The model view controller (MVC) is a popular design pattern that is used in software construction to isolate the business logic from the graphical user interface. In MVC, a controller is used for the purpose of coordination between the model (where the business logic resides) and the view (where the user's interactions occur).

In this chapter, you learn about the available view controllers that are provided in the iPhone SDK. Although you can build iPhone applications without the use of these view controllers, you shouldn't. As you will see in this chapter, view controllers greatly simplify your application.

Section 7.1 provides a gentle introduction to view controllers by presenting a simple application with a single view controller. This application demonstrates important view controller concepts. In Section 7.2, we talk about tab bar controllers and how they can be used in the construction of radio interfaces. In Section 7.3, we talk about navigation controllers used primarily for presenting hierarchical information to the user. After that, Section 7.4 talks about modal view controllers and provides a detailed example showing their appropriate usage. Finally, we summarize the chapter in Section 7.5.

The Simplest View Controller

In this section, we demonstrate the simplest view controller. The application is composed of a view, a view controller, and a data model. The application simply displays a message that describes the orientation of the device. The ...

Get iPhone SDK 3 Programming: Advanced Mobile Development for Apple iPhone and iPod touch 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.