Reputation: 1062
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.
Upvotes: 0
Views: 373
Reputation: 1957
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.
Upvotes: 0
Reputation: 69469
You should do it the other way around.
Place an UINavigationController
in each of the UIViewController
in the UITabbarController
.
Upvotes: 1