开发者

How to access to navigationItem when I am in a view controller in tabBar?

I have view controllers in a tabBar. And the tabBar is in navigationController. I want to access to navigationItem when I am in a view controller in tabBar. Usually, when I set a navigationItem's title, I used to doing this. (if I am in a viewController)

[ [ self navigationItem ] setTitle: @"Menu" ];

开发者_如何学Python

But I am in a view controller in tabBar in navigation controller, this way doesn't work.

A view controller has a navigationItem property. But, although view controllers in tabBar has a navigationItem property, that doesn't work. I think that it is right logically.

Thank you for reading my question.


Assuming your view controller hierarchy looks like

> UINavigationController
   > UITabBarController
      > CustomViewController (CVC)

Controllers in a tab bar controller hold a reference to this controller via the tabBarController property.

In CVC, you can access the navigation item like this: self.tabBarController.navigationItem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜