How to transition smoothly from translucent to opaque UINavigationBar iOS?
I finally found a decent solution!
There doesn't appear to be a proper way to smoothly transition from an opaque to transparent
UINavigationBar BUT you can transition smoothly from a view controller with a visible status bar to one that has a hidden status bar.
This opens up a possible workaround which is to add the following in the
viewWillAppear of VC2 from above:
[self.navigationController setNavigationBarHidden:YES animated:YES];
Once you have that, manually add a
UINavigationBar to your xib and configure it to be transparent (and add all necessary
UIBarButtonItem and views).
If everything is hooked up properly transitioning from VC1 to VC2 will hide the
UINavigationBar at the same speed as the view transition and VC2 will show up with it's embedded
Note: To make this work properly you'll have to make sure that in the
viewWillAppear of View Controllers that can be accessed from VC2 you reset the
UINavigationBar to be visible (if necessary) via:
[self.navigationController setNavigationBarHidden:NO animated:YES];
TL;DR - manually add a
UINavigationBar to your transparent nav bar view controller and in its
viewWillAppear hide the default one via
The black color you're seeing is the background color of the
UINavigationController's view. One way to minimize seeing it is to manipulate the background color of that view to the color of the outgoing / incoming view controller's view. This works well if you're working with solid colors. Another approach is to extend your views behind the opaque navigation bar using
UIViewController.extendedLayoutIncludesOpaqueBars = YES;