0
votes

I have implemented UINavigationController and UITabbarController with each other. I am able to see Navigation bar and Tab bar along with UIViewController.

Problem is when I push any other UIViewController on this controller,that viewcontroller get pushed but Tabbar get disappeared.

Is there any provision to persist that UITabBar along the stack????

below is code I am referring

UIViewController* cont1 = [UIViewController alloc]init];
UIViewController* cont2 = [UIViewController alloc]init];

[tabBarController setViewControllers:[NSArray arrayWithObjects:cont1,cont2,nil]];

Thanks.

2

2 Answers

1
votes

You should do it the other way around. Place an UINavigationController in each of the UIViewController in the UITabbarController.

0
votes
YourViewController *viewController = [YourViewController alloc] init] autorelease];
UINavigationController *controller = [UINavigationController alloc] initWithRootViewController:viewController] autorelease];
controller.title = @"something";
controller.tabBarItem.image = [UIImage imageNamed:@"xx"];
tabController.viewControllers = [NSArray arrayWithObject:controller];

then you can push sub view controllers into navigation controller with tab bar persistent at the bottom of the screen.