I've got an iPhone application with a UITableView
menu. When a row in the table is selected, the appropriate view controller is pushed onto the application's UINavigationController
stack.
My issue is that the MenuViewController
does not need a toolbar, but the UIViewControllers
which are pushed onto the stack do. Each UIViewController
that gets pushed calls setToolbarHidden:animated:
in viewDidAppear:
. To hide the toolbar, I call setToolbarHidden:animated:
in viewWillDisappear:
.
Showing the toolbar works, such that when the pushed view appears the toolbar slides up and the view resizes correctly. However, when the back button is pressed the toolbar slides down but the view does not resize. This means that there's a black strip along the bottom of the view as the other view transitions in. I've tried adding the toolbar's height to the height of the view prior to hiding the toolbar, but this causes the view to be animated during the transition so that there's still a black bar.
I realise I can manage my own UIToolbar, but I'd like to use UINavigationControllers
built in UIToolbar for convenience.
This forum post mentions the same issue, but no workaround is mentioned.
I too have experienced this problem. In my case, the only way I found to successfully hide the toolbar without showing the background of the window is to call [self.navigationController setToolbarHidden:YES animated:animated]
in your view controller’s -viewDidAppear:
method.