-2

I have an UINavigationController which holds an UIViewController. The UIViewController acts like a menu. So I want to present an UITabBarController, by clicking on a button in my UIViewController.
However inside my UITabBarController I need for each ViewController an own UINavigationController itself. By doing something like this: viewControllers = [UINavigationController(rootViewController: myVc()), ...] for my UITabBarController, I end up having a strange navigationBar at the top of my TableView (which is inside of my ViewController, which is presented by my TabBarController) + some warnings in the Xcode console: new observer <UINavigationController: 0x7fd87d846a00>, removing old observer <UINavigationController: 0x7fd87f02ba00>
The navigationBar looks like this:
enter image description here
So the problem is, that I add an UINavigationController inside another UINavigationController (if I remove the second UINavigationController everything works as expected). Unfortunately I need for each (Table)ViewController inside my TabBarController an own UINavigationController, because in the first (Table)ViewController I'm going to attach an UISearchController and if I would attach this UISearchController to the NavigationController which holds my TabBar, then each ViewController inside the TabBar would get this SearchController. How could I solve this problem?
Every help is appreciated!

finebel
  • 2,227
  • 1
  • 9
  • 20

1 Answers1

0

I believe no matter what you do, there should be only one UINavigationController per Navigation stack. If you use more, then it will mess up your navigation bar titles and navigation links.

You can start with a UITabBarController and then have one UINavigationController per Tab item.

Try this solution: How to control multiple navigation controller in an iOS project .

pawello2222
  • 46,897
  • 22
  • 145
  • 209