Attached are two images. The first shows my current main.storyboard, and the second shows my problem when I run the app. I have a tab bar controller that has two tabs. On the first tab there is a button. When pressed, the button goes to another view controller with content. At the top is a Navigation bar with a back button. After viewing content, I press the back button, and am back on the original page with the button, but the tab bar is missing. I have seen a few answered questions, but it appears they made their tab bar in the view controller instead of the storyboard. Another says that I should never return to a previous view unless I use an unwind segue. Is this true? If so, how do I set up an unwind segue. If not, how do I fix this problem otherwise? Thank you. https://i.stack.imgur.com/IYmX2.png https://i.stack.imgur.com/7slt5.png
Tab Bar mysteriously disappears?
1.8k Views Asked by swift-newbie At
2
The problem is in the wiring of your ViewControllers. You have probably embedded your
UITabBarController
inside theUINavigationController
and not the other way around.A correct layout looks like this in Interface Builder :
To reproduce:
UITabBarController
. This will come with 2UIViewController
's already wired in.UIViewController
's (let's call itVController1
) and click on Editor / Embed in / Navigation Controller. This wires theVController1
to live inside aUINavigationController
that is inside theUITabBarController
UIViewController
next toVController1
Let's call itVController3
VController1
andVController3
, for example with a button.I hope that's clear enough