Showing/hiding navigation bar with smooth animation
You can use [navigationController setNavigationBarHidden:YES animated:YES]
to hide the bar smoothly.
Reference
This nifty bit of code animates the navigation bar hiding with no UI issues:
[navigationController setNavigationBarHidden: YES animated:YES]
But...
- Use the self.navigationController.navigationBarHidden property for checks in the code instead of the self.navigationController.navigationBar.hidden property. This will save you a lot of pain from unexpected UI positioning problems.
- Take care to place this method in - (void)viewWillAppear:(BOOL)animated or later in the view lifecycle. This is recommended because if you do it in - (void)viewDidLoad for instance, you will get an ugly black rectangular view during animations from a view which displays its navigation bar to a view which doesn't! For example, if your home view has its navigation bar hidden but all its children have the navigation bar shown, when you pop to home view, the animation will show a black bar in place of the navigation bar until the animation completes