ddzcoeur
ddzcoeur

Reputation: 26

How can i add a tabbarcontroller into a navigation application

I have a navigation application with 3 views, in my second view, I want add a tarbarcontroller and control another two views, how can I do that?

Upvotes: 0

Views: 156

Answers (2)

Kjuly
Kjuly

Reputation: 35181

Let's say you have a tabBarController include two tabs:controller1 & controller1, push it whenever you want.

UITabBarController * tabBarController = [[UITabBarController alloc] init];
UIViewController * controller1 = [[UIViewController alloc] init];
UIViewController * controller2 = [[UIViewController alloc] init];
tabBarController.viewControllers = [NSArray arrayWithObjects:controller1, controller2 nil];
[controller1 release];
[controller2 release];
[self.navigationController pushViewController:tabBarController animated:YES];
[tabBarController release];

Upvotes: 1

DogEatDog
DogEatDog

Reputation: 3047

Allocate a new Tab controller and attach it as a subview to your nav controller in that view.

Upvotes: 0

Related Questions