TabBarController in NavigationController does not show TabBar in viewControllers

微笑、不失礼 提交于 2020-01-03 02:54:11

问题


I have a UITabBarController to whose controllers I would like to attach navigation. So I inserted the NavigationController as the entry controller, and the tabBarController as its root. All seems working fine, but for the tabBar. Basically it does not show, albeit the StoryBoard I attach seems to say differently. I also attach the Account Screen not showing any navigation bar nor, of course, any back button.

Thanks, Fabrizio


回答1:


Just a quick answer. I think you should put UINavigationController inside the TabBarController instead of the other way round. It will solve most of your problems.

Steps: Editor -> Embed in -> Navigation Controller

See the below screen shot on how to add a Navigation Controller to a View Controller.




回答2:


You are following wrong approach, IOS does not allow you to use tabbarview controller as root of navigation controller, it always display black screen. I have faced same problem and as a solution i have added navigation bar after tabbar controller. Yes it becomes difficult to manage, but you can use that way and it will work. If you use programmatic approach instead of storyboard then it is possible, see this link Even you can try from Editor option of XCODE, select tabbar controller you have added from storyboad then go to Editor->Embedded in, you will see that navigation bar controller is disable. This is also give you idea that it will not work.



来源:https://stackoverflow.com/questions/25682640/tabbarcontroller-in-navigationcontroller-does-not-show-tabbar-in-viewcontrollers

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