UINavigationController

The UINavigationController class implements a specialized controller for a navigation bar that manages all aspects of drilling down a hierarchy of objects. It uses application-supplied view controllers to configure the navigation bar and display views below it. Each view controller has a navigation item that provides information on how to set the navigation bar left, middle, and right views.

A navigation controller manages a stack of view controllers much as a navigation bar managing navigation bar items. You push and pop view controllers onto a navigation controller.

Since the UINavigationController class inherits from the UIViewController class, its instances also have a view property. A navigation controller’s view contains a navigation bar and its top view controller’s view in its hierarchy. Therefore, you just need to attach the navigation controller’s view to a window to display it.

Although, navigation controller uses a navigation bar in its implementation, you should never need to, nor should you, access the navigation bar directly. You can, however, access the navigation items that represent the appearance of your view controllers.

You can also add navigation controllers to a toolbar controller. And even, present a navigation controller as a modal view on top of another view controller. In this case, the top view controller’s view is displayed when the navigation controller is presented to the user, and its navigation bar covers any existing navigation bars.

When you pop and push view controllers, the navigation controller updates the navigation bar and view appropriately. At a minimum, the view controller sets the title and view properties.

The view should be a resizable view that can be attached to any view hierarchy. The navigation controller resizes and positions your views depending on where the navigation bar is and whether a toolbar is displayed. Therefore, set the autoresizingMask properties of your views so they are resized appropriately when displayed by the navigation controller.

Tagged:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: