About View Controllers
View controllers present and manage a hierarchy of views. The UIKit framework includes classes for view controllers you can use to set up many of the common user interaction idioms in iOS. You use these view controllers with any custom view controllers you may need to build your app’s user interface. This document describes how to use the view controllers that are provided by the UIKit framework.
At a Glance
Familiarize yourself with the view controllers that you can use in your app. Although you can build an app entirely from custom view controllers, using the provided view controllers reduces the amount of code you have to write and helps you maintain a consistent user experience.
Navigation Controllers Manage Stacks of Other View Controllers
A navigation controller is an instance of the UINavigationController
class that you use as-is in your app. Apps that contain structured content can use navigation controllers to navigate between levels of content. The navigation controller itself manages the display of one or more custom view controllers, each of which manages the data at a specific level in your data hierarchy. The navigation controller also provides controls for determining the current location in this data hierarchy and for navigating back up the hierarchy.
Tab Bar Controllers Manage Independent Sets of View Controllers
A tab bar controller is an instance of the UITabBarController
class that you use as-is in your app. Apps use tab bar controllers to manage multiple distinct interfaces, each of which consists of any number of custom views and view controllers. The tab bar controller also manages interactions with a tab bar view, which the user taps to change the currently selected interface. For example, the iPod app on iPhone and iPod touch uses a tab bar interface where each tab represents a different way of viewing the user’s music and media.
Page View Controllers Manage Paged Display of View Controllers
A page view controller is an instance of the UIPageViewController
class that you use as-is in your app. Apps can use a page view controller to present a paged view of content. The page view controller itself manages the display of one or more content view controllers, each of which provides a single page of content. The page view controller also provides gesture recognizers that allow the user to navigate through its content.
Split View Controllers Manage Two Panes of Information
A split view controller is an instance of the UISplitViewController
class that you use as-is in your app. Apps can use a split view controller to manage two panes of information, where both portions of the interface are themselves managed by view controllers. This interface is similar to a navigation controller, but it takes advantage of the larger screen size of iPad to present more content at a time.
Popovers Present Content in a Floating View
The UIPopoverController
class works with your app’s view controllers to present content in a floating view. This interface takes advantage of the larger screen size of iPad to temporarily present a smaller portion of content in the context of a larger body of content.
View Controllers Are Combined to Build More Sophisticated Interfaces
In all but the simplest apps, it is common for two or more view controllers to work together. Navigation, tab bar, and split view controllers always work in conjunction with other view controllers, and even your custom view controllers may occasionally need to present other view controllers. However, some combinations of view controllers work better than others. Combining view controllers in ways that make sense is important to creating a straightforward, easily navigable user interface.
Prerequisites
View Controller Programming Guide for iOS describes the design patterns and general usage of view controllers on iOS.
App Programming Guide for iOS introduces the development process and describes the core architecture.
App Distribution Guide describes the steps for configuring, building, debugging, and tuning your apps and submitting them to the App Store.
See Also
For guidance about how to design iOS apps, see iOS Human Interface Guidelines.
For information about the view controller classes discussed in this document, see UIKit Framework Reference.
Copyright © 2014 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2014-11-15