-6

Possible Duplicate:
Tab Bar Application With Navigation Controller

My Xcode version is 4.3.2. i Want to add navigation bar in tabbar based application.

Thanks

Community
  • 1
  • 1
Rushabh
  • 3,208
  • 5
  • 28
  • 51

2 Answers2

4

For example, you can make it by using storyboard.

ss

Community
  • 1
  • 1
Feel Physics
  • 2,783
  • 4
  • 25
  • 38
4

In your applicationDidFinishLaunching method you can see something like

FirstViewController *firstViewController = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
.
.
.   

self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:firstViewController, secondViewController, nil];

Add the object of FirstViewController to UINavigationController object as below

UINavigationController *firstNavController = [[UINavigationController alloc] initWithRootViewController:firstViewController];
.
.
.
//And in the tabbarController array add the navigationController Object instaed if FirstViewControllerObject
 self.tabBarController.viewControllers = [NSArray arrayWithObjects:firstNavController, secondViewController, nil];

And its done. Now your FirstViewController will be treated as navigationController and it will have navigationbar.

Edit

If you Just want the navigation bar then you can either insert it from xib or add the UINavigationBar as a subview in self.view

Suresh Varma
  • 9,750
  • 1
  • 60
  • 91