showing/hiding UIToolbar in a UINavigationController without leaving a gap during push/pop transition
I have a UINavigationController with two UIViewControllers. One of the ViewController hides the UIToolbar (the default UIToolbar from the UINavigationController) the other shows it. When I push the ViewController with the UIToolbar onto the ViewController without the UIToolbar the following happens:
The UIToolbar slides up from the bottom and fills a black gap in the new ViewController. This is very ugly since you can see the black background, which is different from the rest and t开发者_如何学运维he animation should ideally mirror the navigationbar animation (slide from right to left). When I pop the ViewController the opposite happens (hiding the UIToolbar slides down to the bottom and leaves a black gap in the popped ViewController)
I hope this makes sense. I just want the UIToolbar to mirror the navigationbar animation (slide from left to right (pop) and right to left (push) ).
I've done research here on SO but couldn't find a satisfactory answer. Is it possible to make the default UIToolbar behave in the manner I described or is it really necessary to create a custom UIToolbar and add it to the ViewController (which doesn't seem very logical since there is a perfectly good one readily available).
Thanks for you consideration!
Regards, Ivo
when you turn on the toolbar, make sure to set it to not animate.
[[self navigationController] setToolbarHidden:NO animated:NO];
I do this in my viewWillAppear of my viewcontroller, and it seems to do the job ok.
精彩评论