Navigation Controllers
A navigation controller (UINavigationController, a subclass of UIViewController) is the most elaborate and powerful of the built-in view controller classes. It is a brilliant solution to the problem of presenting multiple interfaces and options on the tiny iPhone screen. But you might use it also just because its basic interface is useful and familiar to users.
A navigation controller’s interface has three parts:
- The central view
- A navigation controller is a container for other view controllers, and is responsible for displaying the view of one of these at all times. The “navigation” part has to do with how it decides which view controller’s view to display. The navigation controller contains its view controllers in a stack. When a view controller is pushed onto the stack, it becomes the top view controller, and its view becomes the central view (with, by default, an animation from the right). When a view controller is popped from the stack, the view controller underneath it becomes the top view controller, and its view becomes the central view (with, by default, an animation from the left). This behavior is coordinated with the behavior of the navigation bar, as we shall now see.
- The navigation bar
A navigation bar (a UINavigationBar) is a rectangular view displaying a left item, a center item, and a right item. It can be used independently, but it is most often used as part of a navigation controller interface, in which case it appears at the top (and ...
Get Programming iOS 4 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.