UIViewController有一个名为UINavigationItem的属性 .
那么UIViewController如何引用UINavigationBar呢?
在将UIViewController推入UINavigationController之前,UINavigationBar尚未显示 . 所以它在viewDidLoad中不可用 .
那么我们如何定制呢?
我将UINavigationBar添加到了XIB中 . 但是,如何指定我想使用那个UINavigationBar而不是UINavigationController提供的那个?
1 回答
You don't. 导航栏是导航控制器's responsibility -- your view controller doesn' t可以在自己的导航栏中进行交换 . 每个视图控制器都有一个导航项,它可以设置为自定义 Headers 和按钮等简单的东西,你可以获得导航控制器's nav bar when the view controller is pushed onto the navigation stack using the controller' s
navigationController
属性 .