I've setup an App that has a Tab Bar controller as a screen in a navigation controller using the storyboard. I can navigate to it fine, but when I start drilling down through screens in one of the tabs, the tab bar disappears. If I navigate back to the first screen the tab bar is supposed to be on, the tab bar will reappear, but I would prefer if it was visible on the child screens. Is this possible or do the two view controllers just not play well together?
2 Answers
0
votes
The tab bar controller always needs to be the root view controller. You can't put it INSIDE a navigation controller.
Even if it was possible, it wouldn't be good user interaction. What is it you're trying to do exactly (functional)?
I think what you want is to place the navigation controller as the first tab inside the tab bar controller instead. (not the other way around like you're describing)
0
votes
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
MenuViewController * menuViewController=[[[MenuViewController alloc] initWithNibName:@"MenuViewController_iPhone" bundle:nil] autorelease];
menuViewController.hidesBottomBarWhenPushed=YES;
//menuViewController You can have your option here
UINavigationController * navigationController;
UINavigationController * navigationController2;
UINavigationController * navigationController3;
viewController1 = [[[FirstViewController alloc] initWithNibName:@"FirstViewController_iPhone" bundle:nil] autorelease];
viewController2 = [[[SecondViewController alloc] initWithNibName:@"SecondViewController_iPhone" bundle:nil] autorelease];
navigationController=[[UINavigationController alloc] initWithRootViewController:viewController1];
navigationController2=[[UINavigationController alloc] initWithRootViewController:viewController2];
navigationController3=[[UINavigationController alloc] initWithRootViewController:menuViewController];
UITabBarController * tabBarController = [[[UITabBarController alloc] init] autorelease];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:menuViewController,navigationControllerFirst, viewController2, nil];
//self.tabBarController.tabBar.tintColor=[UIColor orangeColor];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return true;
}