iPhone view Controller

What Is a View Controller?


In the Model-view-controller(MVC), a controller object provides the custom logic needed to bridge the application’s data to the views and other visual entities used to present that data to the user. In iPhone applications, a view controller is a specific type of controller object that you use to present and manage the views of your application. View controller objects are descendants of the UIVcontroller class, which is defined in the UIKit framework.


View controllers play a very important role in the design and implementation of iPhone applications. Applications running on iPhone OS–based devices have a limited amount of screen space for displaying content and therefore must be creative in how they present information to the user. Applications that have lots of content must generally distribute that content across multiple screens and show and hide each screen at appropriate times. View controller objects provide the infrastructure for managing the views being shown and for coordinating the showing and hiding of them.


There are many reasons to use view controllers in your application and few reasons to avoid them. View controllers make it easier for you to implement many of the standard interface behaviors found in iPhone applications. They provide default behavior that you can use as is or customize when needed. They also provide a convenient way to organize your application’s user interface and content.


Figures here shows an example of three different (but related) screens from an application that manages recipes. The first screen lists the recipes that the application manages. Tapping one of the recipes displays the second screen, which shows the details of the recipe. Tapping the recipe’s picture in this detail view displays the third screen, which displays a picture of the resulting dish that fills the screen. Managing each of these screens is a distinct view controller object whose job is to present the appropriate view objects, populate those views with data, and respond to interactions with that view.

In addition to displaying and managing views, you can also use view controllers to manage the navigation from screen to screen. In iPhone OS, there are several standard techniques for presenting new screens. All of these techniques are implemented using view controllers and are discussed at different points throughout this document.



No comments:

 
Top Blogs