1

I am facing issue of displaying navigation controller and tab bar controller together either one is displayed depending on the position of adding subview in applicationlaunch method.

   - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:     (NSDictionary *)launchOptions {    

// Override point for customization after application launch.
   navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;
// Add the view controller's view to the window and display.
[self.window addSubview:navigationController.view];
[self.window addSubview:tabBarController.view];

[self.window makeKeyAndVisible];

return YES;
 }
Harshal
  • 201
  • 1
  • 4
  • 16

2 Answers2

0

Yes only one can be display at one time. You can set navigation controller in tabs of tabBarController then you can see both at same time.

enter image description here

look at item 1 now its viewController change it to navigation controller.

saadnib
  • 11,145
  • 2
  • 33
  • 54
  • But then it displays for only one view not for other views – Harshal Apr 07 '11 at 06:14
  • sorry but i was unable to understand what are you saying? – saadnib Apr 07 '11 at 06:16
  • i have 4 tabs with different views so when i add navigation controller inside tab controller it adds its own tab named "item" and displays navigation bar for that same view with tab item. – Harshal Apr 07 '11 at 06:19
  • i have updated my answer look at there how to add navigation controller in tab bar controller tabs. – saadnib Apr 07 '11 at 06:36
0

You can add one of controller either navigationController or TabbarController at a time. If you add Tabbar controller and in that controller you add Navigation controller then you can see both.

dks1725
  • 1,631
  • 1
  • 20
  • 29
  • but then it displays for only one view not for other views – Harshal Apr 07 '11 at 06:15
  • yes you can see only one view at a time.which view is your first view based on that you have to add your controller. – dks1725 Apr 07 '11 at 06:17
  • If you add tabbar controller and add navigation controller as subview of tabbar then you are able to do all functionality by code...means you can hide tabbar or navigation bar as well...so its upto you. – dks1725 Apr 07 '11 at 06:18
  • i have 4 tabs with different views so when i add navigation controller inside tab controller it adds its own tab named "item" and displays navigation bar for that same view with tab item. – Harshal Apr 07 '11 at 06:21