navigationController

The nearest ancestor in the view controller hierarchy that is a navigation controller. (read-only)

@property(nonatomic, readonly, retain) UINavigationController *navigationController

Discussion

If the receiver or one of its ancestors is a child of a navigation controller, this property contains the owning navigation controller. This property is nil if the view controller is not embedded inside a navigation controller.

Availability

  • Available in iOS 2.0 and later.

See Also

  •   @property splitViewController
  •   @property tabBarController

Related Sample Code

Declared In

UINavigationController.h

navigationItem

The navigation item used to represent the view controller in a parent’s navigation bar. (read-only)

@property(nonatomic, readonly, retain) UINavigationItem *navigationItem

Discussion

This is a unique instance of UINavigationItem created to represent the view controller when it is pushed onto a navigation controller. The first time the property is accessed, the UINavigationItem object is created. Therefore, you shouldn’t access this property if you are not using a navigation controller to display the view controller. To ensure the navigation item is configured, you can either override this property and add code to create the bar button items when first accessed or create the items in your view controller’s initialization code.

Avoid tying the creation of bar button items in your navigation item to the creation of your view controller’s view. The navigation item of a view controller may be retrieved independently of the view controller’s view. For example, when pushing two view controllers onto a navigation stack, the topmost view controller becomes visible, but the other view controller’s navigation item may be retrieved in order to present its back button.

The default behavior is to create a navigation item that displays the view controller’s title.

Availability

  • Available in iOS 2.0 and later.

Related Sample Code

Declared In

UINavigationController.h

nibBundle

Return the name of the receiver’s nib bundle if it exists. (read-only)

@property(nonatomic, readonly, retain) NSBundle *nibBundle

Availability

  • Available in iOS 2.0 and later.

See Also

  • – initWithNibName:bundle:
  •   @property nibName

Declared In

UIViewController.h

nibName

Return the name of the receiver’s nib file, if one was specified. (read-only)

@property(nonatomic, readonly, copy) NSString *nibName

Discussion

This property contains the value specified at initialization time to the initWithNibName:bundle: method. The value of this property may be nil.

If you use a nib file to store your view controller’s view, it is recommended that you specify that nib file explicitly when initializing your view controller. However, if you do not specify a nib name, and do not override the loadView method in your custom subclass, the view controller searches for a nib file using other means. Specifically, it looks for a nib file with an appropriate name (without the .nib extension) and loads that nib file whenever its view is requested. Specifically, it looks (in order) for a nib file with one of the following names:

  1. If the view controller class name ends with the word “Controller”, as in MyViewController, it looks for a nib file whose name matches the class name without the word “Controller”, as in MyView.nib.
  2. It looks for a nib file whose name matches the name of the view controller class. For example, if the class name is MyViewController, it looks for a MyViewController.nib file.

Availability

  • Available in iOS 2.0 and later.

See Also

  • – initWithNibName:bundle:
  •   @property nibBundle

Declared In

UIViewController.h

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值