Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Pushing a tabBarController into a NavController isn't recommended, instead set a NavigatorController for every tabBar View controller, and set the TabBarController as the main window root view controller.</p> <p>If you want to be able to show a screen before showing the tabbar, a solution is to push in all the navigator controllers the previous view controller, followed by the one you want to show (that way all navbars has the backbutton). <strike>Then set <code>hidesBottomBarWhenPushed = YES</code> to the first view controller, that way it won't show the tabBar</strike>.</p> <p>Example Code:</p> <pre><code>UIViewController *prevc = [[UIViewController alloc] init]; //prevc.hidesBottomBarWhenPushed = YES; //Do this for every VC that will be a tabBarItem UIViewController *vc1 = [[UIViewController alloc] init]; UINavigationController *nv1 = [[UINavigationController alloc] initWithRootViewController:prevc]; [nv1 pushViewController:vc1 animated:NO]; //Remember to set the tabBarItem! UITabBarController *tb = [[UITabBarController alloc] init]; tb.viewControllers = [NSArray arrayWithObjects:nv1, nv2, nv3, nil]; </code></pre> <p>I just realized that setting hidesBottomBarWhenPushed to the previous ViewController won't work well, but If you show prevc first, and then push the following viewController, you won't have problems. But if anyway you wan't to hide the tab bar while doing a pop, please check this:</p> <ul> <li><a href="https://stackoverflow.com/questions/5569961/hidesbottombarwhenpushed-but-when-popped">hidesBottomBarWhenPushed but when popped</a> </li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload