问题
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
UITabBarControlleras is Initial View Controller - add a relationship to each scene, whether it is a
UINavigationControlleror 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