Navigation Controller Header is not showing

为君一笑 提交于 2019-12-25 03:57:20

问题


So, here I basically have this layout

but when I build successfully I am not able to see the title of the navigation controller.

What can I do?


回答1:


This is what you want to emulate:

  • Set the UITabBarController as is Initial View Controller
  • add a relationship to each scene, whether it is a UINavigationController or not
  • If a scene is a UINavigationController, it will behave like any root navigation controller, with its own view stack, back button, an so forth.

Running the app above, then tapping on Item 2 will present this navigation controller:


If you cannot make the UITabBarController the initial View Controller at launch, you can make it become root later on using this technique:

let newViewController = self.storyboard?.instantiateViewControllerWithIdentifier("id")
                        as? UIViewController
self.view.window?.rootViewController = newViewController

This will present the architecture above, albeit without animation (nor any way to navigate back). Perfect for onboarding or login screens.


Tested on Xcode 7+, iOS 9+




回答2:


Make your TabBar Controller the initial view, And make sure to remove the navigation controller that's linked to it, Then it should work fine.



来源:https://stackoverflow.com/questions/34949894/navigation-controller-header-is-not-showing

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