anonymous anonymous - 3 months ago 10
iOS Question

Why is the tab bar not appearing throughout the app?

I have implemented a tab bar, but as I go through the app I am not seeing the tab bar. It disappears after I go to a certain page. This is how I implemented it. I have a tab bar connected to a vc which is embedded inside a navigation controller. So the hierarchy looks like this.

----UITabBarController

-------UINavigationController

-----------ViewController 1 with button to view controller 2 (I can see the tab bar)

----------------View Controller 2 (I can't see the tab bar)

Answer

It sounds like the segue that you get from view controller 1 to view controller 2 is a "present" segue, rather than a "push" segue. (If I recall correctly, Apple removed "push" segues from Storyboards recently.) Sadly, "present"ed view controllers appear in front of the navigation controller.

In order to do a "push" segue, you have to do it in code, e.g.:

- (IBAction)buttonTapped: (id)sender
{
     ViewController2 *viewController = ...
     [self.navigationController pushViewController:viewController];
}