Iphone – Setting hidesBottomBarWhenPushed leaves bottom bar missing after View Controller is popped

cocoa-touchiphoneuikit

I have the following setup:

A tab bar app.
On one tab there is a navigation controller.

My workflow:

When I push a new viewController onto the navigation controller stack, I set the hidesBottomBarWhenPushed property.

This works great, the tab bar is "pushed" as the new view controller slides in place.

The problem:

When I pop this view controller and the root view controller is once again displayed, however, the tab bar is gone.

The navigation controller has grown to fill the space left by tab bar.

Is there a property I need to set to make the tab bar visible again?


What I have tried:

popping to the root view manually

setting (resetting) the hidesBottomBarWhenPushed for the root view

resizing the root view

resizing the view property of the navigation controller (just leaves a "white space" where the tab bat should be)

What "sorta" worked:

If I set the selected index of the tab bar controller to any other index, the tab bar appears. So I know it is still "around", but this does little to help me.

Best Answer

I had this problem too. I was setting -hidesBottomBarWhenPushed on the wrong view controller.

Wrong (but seems to work until you pop):

self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:self.anotherViewController animated:animated];

Right:

self.anotherViewController.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:self.anotherViewController animated:animated];