I am using the UINavigationController toolbar. Before I show it, I resize my views so that they do not block on the toolbar (I set the frame of the current view controller view to a straight line located from the bottom of the navigationBar to the top of the toolbar .
But not all controllers of my kind have toolbarItems . Thus, when switching from a view controller that has elements (controller A) to one that does not work (controller B), I want to hide the toolbar. However, when I call setToolbarHidden:animated: in the B method of viewWillAppear:animated: the toolbar is animated during the transition and shows the UIWindow background behind it.
This also happens in the opposite direction: when moving from B to A (using the "Back" button) I want the toolbar to animate in order to display A toolbarItems , but since the view A does not extend to the bottom screen, UIWindow displayed during pop -transition.
Perhaps this was not the best description, so here is a screenshot:

I tried updating the frame in my viewWillDisappear:animated: method, but it does weird things, as it seems to be called inside the push animation block UINavigationController . Any insight would be appreciated.
Refresh . I tried to hide the toolbar in B viewDidAppear:animated: but the results were not perfect. Using this solution, the toolbar is not discarded until the transition to push is complete. Since B does not have any toolbarItems , elements of A will move to the left during the transition, leaving a blank toolbar on the screen before it disappears. In addition, when I return to the background, the UIWindow will be visible if I do not set the toolbar to the viewWillDisappear:animated: visible in B, which would mean that B should know that A has toolbarItems .
source share