How to used navigation controller and tab bar controller in appdelegate file

若如初见. 提交于 2019-12-08 06:38:36

问题


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;
 }

回答1:


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.

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




回答2:


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.



来源:https://stackoverflow.com/questions/5576604/how-to-used-navigation-controller-and-tab-bar-controller-in-appdelegate-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!