For iOS applications, view controllers provide a vital link between an application’s data and visual appearance. View controllers are traditional controller objects in the Model-View-Controller design paradigm but they also provide much more. In iOS applications, view controllers provide much of the logic needed to manage basic application behaviors. For example, view controllers manage the presentation and removal of content from the screen and they manage the reorientation of views in response to device orientation changes.
Understanding when and how to use view controllers is crucial to the design of iOS applications. View controllers provide fundamental infrastructure that makes it easier for you to implement your applications and ensures that your applications behave consistently with the platform’s interface guidelines. Of course, the basic features provided by view controllers can only go so far. At some point, your custom code must take over to present your custom content. This document shows you what behaviors view controllers provide and where you can customize those behaviors to suit your own needs.
Important: The contents of this document apply to iOS applications only. Although Mac OS X applications also support a type of view controller, they do so using a different class that has different requirements and behaviors.
Before you start reading this document, you should have at least a fundamental understanding of the following Cocoa concepts:
Basic information about Xcode and Interface Builder and their role in developing applications
How to define new Objective-C classes
How to manage memory, including how to create and release objects in Objective-C
The role of delegate objects in managing application behaviors
A basic understanding of the Model-View-Controller paradigm
Developers who are new to Cocoa and Objective-C can get information about all of these topics in Cocoa Fundamentals Guide.
Development of iOS applications requires an Intel-based Macintosh computer running Mac OS X v10.5 or later. You must also download and install the iPhone SDK. For information about how to get the iPhone SDK, go to http://developer.apple.com/iphone/.
This document contains the following chapters:
“About View Controllers” provides an overview of view controllers and the role they play in iOS applications.
“Custom View Controllers” describes the basic behaviors supported by all view controllers and how you can create custom view controllers for use in your application.
“Navigation Controllers” shows you how to create and configure navigation controllers.
“Tab Bar Controllers” shows you how to create and configure tab bar controllers.
“Modal View Controllers” shows you how to present view controllers modally and offers guidance on when to do so.
“Combined View Controller Interfaces” shows you how to mix different types of view controllers to create sophisticated user interfaces.
If you have feedback about the documentation, you can provide it using the built-in feedback form at the bottom of every page.
If you encounter bugs in Apple software or documentation, you are encouraged to report them to Apple. You can also file enhancement requests to indicate features you would like to see in future revisions of a product or document. To file bugs or enhancement requests, go to the Bug Reporting page of the Apple Developer website:
http://developer.apple.com/bugreporter/
To file bugs, you must be registered as an Apple Developer. You can obtain a login name for free by following the instructions on the Apple Developer Registration page.
For additional information about application design, see iOS Application Programming Guide and iPhone Human Interface Guidelines.
For information about the view controller classes discussed in this document, see UIKit Framework Reference.
Last updated: 2010-07-08