Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple view controllers with same tab controller

Am using tab controller in my application, i have 5 main tabs. But each controller navigate to another controllers, i want the sub controllers to hav the same tabs and the tabbed tab will be the main controller it was navigated from ...

for example:

enter image description here

I want the controller in the red square to have the same main tabs and the tab in the middle is clicked when navigating to it ..

how to achieve this?

like image 346
Lama Avatar asked May 20 '26 14:05

Lama


2 Answers

You need to add a UINavigationController right after the UITabBarController.

For a quick Storyboard fix, select the first UIViewController after the UITabBarController and in Xcode menu do Editor -> Embed In -> Navigation Controller

enter image description here

like image 65
thedp Avatar answered May 22 '26 04:05

thedp


Connect all your First View Controllers that are attached to TabBarController with UINavigationController like this:

The reason why we do this because we need to open other ViewControllers in our TabBarController. If we don't use NavigationController then it produce nil and doesn't show the tabBar on other ViewControllers.

like image 34
Wings Avatar answered May 22 '26 05:05

Wings



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!