I wasn't lucky with searching for this, so here we go ;)
I have a UIViewController
with a custom UINavigationBar
which pushes another UIViewController
as subview.
Everything works fine except when I click the back button on the subview. The previews (first) view appears correctly, but not animated. The animation of the UINavigationBar
is correct, only the views switch immediately.
The function - (void)viewWillAppear:(BOOL)animated
of the first UIViewController
gets called with NO
for animated
. This only happens when I test with iOS 5, not with iOS 4.
Does anyone know how to fix this?
Thanks for your help! Hannes
UPDATE 1
I just removed all custom code and just used the plain UINavigationBar
(so no extra settings) and it still doesn't work with iOS 5. This is my code I use in the first ViewController to push the second ViewController:
[self.navigationController pushViewController:secondViewController animated:YES];
As I already mentioned - when I click the back button in the navigation bar on the second view the first view appears immediately without animation.
Any help would be appreciated! Thanks!
UPDATE 2
I feel like I'm getting closer to the issue, but still no solution:
I just added a custom UINavigationController
where I just call [super popViewControllerAnimated:animated]
. This get's called correctly (animated is YES) but the viewWillAppear
of the first UIViewController
gets NO as value for animated...
I was having a similar problem today where the
UIViewController
was getting NO inviewWillAppear
, except with the standardUINavigationBar
andUINavigationController
.It turned out to be due to manually calling
viewWillAppear:YES
somewhere it shouldn't have been. This item suggests that it can also be caused by calling the wrongsuper
method somewhere (e.g.[super viewWillAppear:animated]
instead of[super viewDidAppear:animated]
inside ofviewDidAppear
).As for using a custom
UINavigationBar
, I ran across this link today that may help your case: http://sloshire1.posterous.com/simple-fix-for-viewwillappear-in-ios5