Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I hide the bottom bar when pushed but stay in the main view Controller

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.

like image 403
Hassan Taleb Avatar asked Nov 05 '25 00:11

Hassan Taleb


2 Answers

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
            }
        }
    }
}
like image 102
Norman Avatar answered Nov 07 '25 16:11

Norman


Question is old, but first in google search.

From interface builder, use checkbox "Hide Bottom Bar on Push":

enter image description here

like image 29
Dima Rostopira Avatar answered Nov 07 '25 16:11

Dima Rostopira