Reputation: 547
iOS beginner here. I'm Using XCode 4.6.3 and doing some tutorials. I have a question regarding a TabbedView not displaying the Navigation bar:
I set the Top Bar attribute to "Navigation Bar" here :
But it doesn't show here :
Below is the code in the AppDelegate :
self.navController = [[UINavigationController alloc] initWithRootViewController:viewController1];
self.navController.navigationBar.barStyle = UIBarStyleBlack;
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = @[viewController1, viewController2];
self.window.rootViewController = self.tabBarController;
What am I doing wrong?
Upvotes: 0
Views: 63
Reputation: 3658
You have UITabBarController as rootViewController of your UINavigationController. And UINavigationController as root Controller of your app. Instead of that you have to set UITabBarController as root Controller of your App and add UINavigationController in each tab.
Check this answer.
Upvotes: 0
Reputation: 27225
You have initialized your Navigation Controller with your First View Controller. So, you have to use Navigation Controller for the Tab Bar's View Controllers.
Change this Line
self.tabBarController.viewControllers = @[viewController1, viewController2];
With
self.tabBarController.viewControllers = @[self.navController, viewController2];
Upvotes: 3