For some reason, my bottom nav bar is not hiding on my main view controller (blue screen in the following storyboard):
I do not want a tab bar to display on the bottom of the blue screen, so I've put in the following code in its view controller:
override func viewWillAppear(animated: Bool) {
self.navigationController?.setToolbarHidden(true, animated: animated)
self.navigationController?.setNavigationBarHidden(true, animated: animated)
super.viewWillAppear(animated)
}
override func viewWillDisappear(animated: Bool) {
self.navigationController?.setToolbarHidden(false, animated: animated)
self.navigationController?.setNavigationBarHidden(false, animated: animated)
super.viewWillDisappear(animated)
}
It top navigation bar is not displaying (as expected), but the bottom bar is not hiding. It's also displaying twice on every screen thereafter (see screenshot below):
Is it because I have a Tab Bar Controller in my interface builder? Is there a way to implement the tab bar controller with four icons programmatically instead? The only screen that I really want the tab bar controller to be on is the Table View.
Use hidesBottomBarWhenPushed
In the view controller with blue background color:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if let desVC: UIViewController = segue.destinationViewController as? UIViewController {
desVC.hidesBottomBarWhenPushed = true
}
}
删除此行self.navigationController?.setToolbarHidden(true, animated: animated)
和TextField
顶部连接(安全区域)更改Superview
。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.