This problem still exists in iOS 10. The UINavigationController, built into the container view, which in turn is contained in the UITabBarController, will display all the views in the navigation stack with additional space for the phantom tab bar at the bottom.
The simplest solution is to subclass UINavigationController and return 'nil' from tabBarController .
class MyNavigationController: UINavigationController { override var tabBarController: UITabBarController? { return nil } }
This makes representations in the navigation stack, thinking that they donβt have a tab bar controller, so they wonβt leave extra space for it during the layout. I did not notice any negative side effects from this fix, but obviously the views on this navigation controller stack will no longer have access to the tab bar controller. If this is a problem, you can use a more general method to find the tab bar controller (or any "parent" view controller).
For example, if the main view controller for your application is a UITabBarController named "MainViewController", you can extend the UIViewController using a convenient method to find it.
extension UIViewController { func mainViewController() -> MainViewController? { var vc: UIViewController? = self while !(vc is MainViewController) && vc != nil { vc = vc?.parent ?? vc?.navigationController ?? vc?.presentingViewController } return vc as? MainViewController } }
This works because the tab bar controller is the parent its direct child view controllers. The above method works through a chain of parent, presentation, and navigation controllers to ultimately reach the child of the tab bar controller, which returns the tab bar controller as the parent.
source share