1

I'm using a TabController which has a Navigation Controller as it's root and all works fine thus far except i would like to show the NavigationBar of the child viewcontrollers within the tab bar but for now just the tabcontroller's Navigation Bar shows.

This is how the tab bar shows now. with It's NavBar

This is the TabBar's header

This is the Navbar of the child ViewController I want to show

This is the Navbar of the child ViewController which i want to show

John
  • 410
  • 1
  • 4
  • 19

1 Answers1

0

Embed a UINavigationController for each tab bar item rather than a UIViewController. You can then make the root view controller of each UINavigationController point to the view controller you want to use for that tab.

enter image description here

This allows each tab to have its own navigation bar and navigation stack.

EDIT

Also, if you intend on keeping your current navigation controller as the initial view controller, make sure you hide it's navigation bar by unselecting "Shows Navigation Bar" in interface builder

enter image description here

or by setting it in UITabBarController:

self.navigationController?navigationBar.isHidden = true

or by setting it in UINavigationController:

self.navigationBar.isHidden = true
Jake
  • 13,097
  • 9
  • 44
  • 73
  • I did but now both the Tab controllers navigation bar and the view controllers navigation bar is showing same times – John Feb 06 '18 at 23:08
  • You need to remove the navigation controller the contains the tab bar controller. Or if that navigation controller is also required, you can set it's navigation bar to hidden. – Jake Feb 06 '18 at 23:09
  • So it works now but Large title property for the navBar isn't working. I tried enabling it both by code and on storyboard but it just isn't showing. – John Feb 06 '18 at 23:43
  • 1
    Works now. Had to set the property in the individual Navigationcontroller's Navigation bar. Thanks man – John Feb 06 '18 at 23:56