views:

27

answers:

3

Hello!, I have a tabBarController with 4 tabs. In the fist one I need to show an UINavigationController which has a UIView in it. When the user presses a button inside that view I need to display another UINavigationController in tab 1 replacing the old one. Is this possible? I tried using this code with no luck

UINavigationController *tableNavController = [[UINavigationController alloc] initWithNibName:@"Nav2" bundle:nil];

[[self.tabBarController selectedViewController] setView:tableNavController.view];

This replaces the view but not the controller. Please help. Thanks in advance.

A: 

Anyone? Please help

Pablo Caruso
A: 

Why not just push a fresh viewController onto tab 1's navigationController?

Ben Gottlieb
Hi Ben!, thanks for your answer, I'm quite new at iphone development can you explain me a bit how can I do that? My thing is that the NavigationController is created by using Interface Builder when selecting each tab's controller, so I dont know how to have access to it to change its View
Pablo Caruso
You need a reference to it in one of your classes (probably whatever owns or creates the tab controller). Then you just use -pushViewController:animated:. I personally never use IB to create controllers; I always do that in code.
Ben Gottlieb
A: 

Hi Ben!, thanks for your answer, I'm quite new at iphone development can you explain me a bit how can I do that? My thing is that the NavigationController is created by using Interface Builder when selecting each tab's controller, so I dont know how to have access to it to change its View

Pablo Caruso