Reputation: 1929
I have embedded a viewController
in a NavigationController
and set it as the rootViewController
. Then I connected the TabBarController
to the NavigationController
. I have a button in the LessonViewController
that shows the PurchaseViewController
, and then a back button in the PurchaseViewController
which shows the LessonViewController
. However, the tab bar was still present in the PurchaseViewController
so I ticked hideBottomBarOnPush
, which solved this problem, however, when I segued back to the LessonViewController
the tab bar had disappeared.
Any ideas?
The following image is what my storyboard looks like now:
Upvotes: 0
Views: 1194
Reputation: 1929
Similar to barb’s code, I got this to work, while enabling “hide bottom toolbar when pushed” and then popping the view controller:
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
self.tabBarController?.tabBar.hidden = false
}
Upvotes: 1
Reputation: 6555
You should do following way,
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "Your_Identifier" {
hidesBottomBarWhenPushed = true
DispatchQueue.main.async { self.hidesBottomBarWhenPushed = false }
}
}
It will show TabBar reappears while segue back.
Upvotes: 0