Search code examples
iosswiftxcodestoryboarduitabbarcontroller

How do I keep my tab bar visible when segueing to another view controller?


The problem I'm currently facing is that I would like to segue from the orange view controller to the yellow view controller by pressing on an icon on the top right hand corner of the orange controller. The issue that I am facing is that when I do click the icon in the simulator, it goes to the yellow controller but the tab bar disappears. How do I ensure the tab bar doesn't disappear when segueing to other views from views that are accessible from the tab bar? Thanks!

Flowchart


Solution

  • You need to wrap your Orange HomeViewController inside a UINavigationController and embed this UINavigationController inside the UITabBarController. When you navigate from Orange to Yellow, you can push it on to the Orange's navigation controller.

    When you do a push call on the UINavigationController that's embedded inside the UITabBarController, it will keep the TabBar visible in the next screen.