I am unable to set a certain tab view to be a UiNavigation controller. The warning I get is:
Pushing a navigation controller is not supported
Here is my code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
UIViewController *viewController1, *viewController2, *viewController3, *viewController4;
viewController1 = [[HomeViewController alloc] initWithNibName:@"HomeViewController_iPhone" bundle:nil];
viewController2 = [[SearchViewController alloc] initWithNibName:@"SearchViewController_iPhone" bundle:nil];
viewController3 = [[ListViewController alloc] initWithNibName:@"ListViewController_iPhone" bundle:nil];
viewController4 = [[InfoViewController alloc] initWithNibName:@"InfoViewController_iPhone" bundle:nil];
self.tabBarController = [[UITabBarController alloc] init];
UINavigationController * listNavController = [[UINavigationController alloc] initWithRootViewController:viewController3];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2, listNavController, viewController4, nil];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return YES;
}
to
and keep a reference to the nav controller if needed. I think that would be the right way to do it, but you could also wrap the nav controller in a simple UIViewController. You would want to do this if viewController3 is not guaranteed to be the bottom most VC in your stack at all times.