Overview of UINavigationController Class Reference

来源:互联网 发布:时事评论类节目 知乎 编辑:程序博客网 时间:2024/06/05 22:57

The UINavigationController class implements a specialized controller for a navigation bar that manages all aspects(方面) of drilling down(钻取) a hierarchy(阶层,['haiәrɑ:ki]) 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(适当的[ә'prәʋprieit]). 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.

Read View Controller Programming Guide for iPhone OS to learn how to use this class.

This class is not intended(打算) to be subclassed.

原创粉丝点击