I have a UITableViewController
that is embedded in a UINavigationController
and in a UITabBarController
.
When I select a row, I want to open my UIViewController
in the UINavigationController
but not in the UITabBarController
.
When I create the segue
from the cell to my UIViewController
in the Interface Builder
, I select Show (eg. Push)
.
The problem is that it keeps the UITabBarController
as well.
Then I tried the other kinds of segue but none of them display the UINavigationController
.
I thought about adding self.tabBarController?.tabBar.hidden = true
in viewDidLoad()
and override willMoveToParentViewController
:
override func willMoveToParentViewController(parent: UIViewController?) {
super.willMoveToParentViewController(parent)
if parent == nil {
self.tabBarController?.tabBar.hidden = false
}
}
It works fine except when I make a driven transition (paning from the edge to go back to the parent view controller).
How to do it the proper way?