Search code examples
iosswiftxcodeuinavigationcontrolleruinavigationbar

Large title hidden in ViewController even though properly set


I'm having some issues with my NavigationController, specifically with the title. Even though I think I set up my large title correctly, it doesn't show correctly in the simulator.

Link to GitHub: Github link

I have tried:

  • Restarting Xcode & the simulator
  • Removing & re-adding the NavigationController
  • Following code is attached for reference:
    navigationController?.title = "Groceries"
    self.navigationItem.title = "Groceries1"
    title = "Groceries2"

None of the above resolved the issue. The problem only persists on the AccountViewController and the TableViewController, which are both connected to the TabBar.

Something that may be related:

self.navigationItem.setHidesBackButton(true, animated: true)

It doesn't work either. How can I make sure the title shows? (And if it's related: how can I make sure the back button is hidden?)

Thanks a lot.

This is what shows in the simulator

My NavigationController

Settings for the title of TableViewController


Solution

  • The problem was that I was trying to edit the NavigationController's title, while the NavigationController was overridden by the TabBarController. I have managed to solve the issue by placing the following in the ViewWillAppear:

    tabBarController?.title = "Groceries"
    

    This has solved the issue. Thank you all for taking the time to look into the issue!