Reputation: 2536
I want to hide the bottom bar when I press a button or a cell ( in a table ) in the main view controller to push to another view controller and not when I press a button in the bottom bar . And when I back to that main view controller I want get back the bottom bar
I tried the code in the main view controller : hidesBottomBarWhenPushed = true
But when I press on an item in the bottom bar and get back to the main view controller the bottom bar is disappear, and the same when I go to new view controller (by push from the main view controller), the bottom bar in the main view controller disappears.
Upvotes: 4
Views: 10959
Reputation: 11185
Question is old, but first in google search.
From interface builder, use checkbox "Hide Bottom Bar on Push":
Upvotes: 7
Reputation: 2210
Since PeiweiChen's answer didn't work for me, i came up with this instead:
(One has to put this in to the pushed View Controllers file)
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.hidesBottomBarWhenPushed = true
}
PS.: This is Swift 2.0
Upvotes: 0
Reputation: 413
In your pushed View controller :
init() {
super.init(nibName: nil, bundle: nil)
self.hidesBottomBarWhenPushed = true
}
Upvotes: 0
Reputation: 93
So far I can see you have to hide the bottom bar already in the prepareForSegue func in your first view controller. The code below works fine on my side:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "yourSegue" {
if let indexPath = tableView.indexPathForSelectedRow() {
if let destVC = segue.destinationViewController as? TargetVC {
destVC.hidesBottomBarWhenPushed = true
}
}
}
}
Upvotes: 9