Hiding a UINavigationController's UIToolbar during viewWillDisappear:
Posted
by Nathan de Vries
on Stack Overflow
See other posts from Stack Overflow
or by Nathan de Vries
Published on 2010-02-26T05:45:01Z
Indexed on
2010/04/30
18:37 UTC
Read the original article
Hit count: 495
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.
© Stack Overflow or respective owner