I am trying to get my app working so that in the root view controller, no navigation bar is visible, and when I push another view controller onto my stack (using Storyboard segues), the navigation bar animates into view (fades into view as the view slides into view).
As recommended in other SO articles, I have the following in my root controller:
- (void)viewWillAppear:(BOOL)animated
{
[self.navigationController setNavigationBarHidden:YES animated:animated];
[super viewWillAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
[self.navigationController setNavigationBarHidden:NO animated:YES];
[super viewWillDisappear:animated];
}
The navigation bar does appear/disappear correctly, it just doesn't animate (fade in/out).
I am using a black translucent bar, but I've tried all types of bar and there's no difference. This is on an iPhone app. I've tried also simulator and non-simulator. Any ideas?
I have now created a video showing a demonstration of what my app is doing:
So just to be clear, it IS appearing and disappearing properly, but it happens suddenly. I am trying to get it to fade in/out during this transition.
I've now added a link to my demo project in Xcode 4 / iOS 5.1:
https://www.dropbox.com/sh/mwsgjyup4iumy2r/QNN7xkHXSt
UPDATE/ANSWER: Ultimately it turns out that my code is "working," in that it is doing what Apple intended, animating the navigation bar sliding into view. I was under the false impression that it should also be fading the navigation bar from invisible to visible at the same time, but that is not how it works.
Thanks to @E. Lüders for animation code that shows how to do what I had intended.