0
votes

Basically, I have a UINavController a RootView controller (plain ViewController), then a TabBar Controller.

When I call self.title, it changes the tab items title, not the navcontrollers title.

  • Nav Controller
    • ViewController
      • Tab Bar Controller
        • View A
        • View B

View A is where I call self.navigationController?.title and self.title, nothing works.

1
What is your purpose for trying to se the title of the navigation controller? The titles that appear on the navigation bar, are the navigationItem titles of the controller that's on screen, not the title of the navigation controller, if that's what you're trying to do. - rdelmar
That's what I did, I added a Navigation Item, but when I try and set it in viewDidLoad, it does nothing. - 21Canadians
You shouldn't be adding a navigation item; you should already have one from the navigation controller (I'm assuming that you're pushing the tab bar controller from ViewController). - rdelmar

1 Answers

1
votes

The reason you can't set the title with self.title, is because the navigationItem, in your setup apparently belongs to the tab bar controller, not controller A. You can set the title with self.tabBarController.title.