2
votes

When I receive a local notification i do the following:

- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notif {
    [navController popToRootViewControllerAnimated:NO];
    [navController pushViewController:notificationSplashViewController animated:YES];
}

If my notificationSplashViewController is the current ViewController, its viewWillAppear() method is not invoked. How can I detect the re-push of notificationSplashViewController?

1
wild guess - what happens if you animate the pop?Rayfleck
... a disaster! The navigation bar gets crazy, overlapping all the titles of the pushed viewcontrollers. Actually, on the console I get: nested push animation can result in corrupted navigation bar Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.Ivan Leonardi
Gaak! That is bad. Don't do that :-) Another wild guess - move the push into it's own method (called thePushMethod), and after the pop, invoke that method like this: [self performSelector:@selector(thePushMethod) withObject:nil afterDelay:0.0];Rayfleck
Fine! It works! :) Thank you! Could you explain me why this workaround works?Ivan Leonardi
When you invoke a selector like that, it does not do it in real time, it puts it on queue to be performed during the next run-loop, and that gives it enough time for the first animation to finish.Rayfleck

1 Answers

0
votes

Try:

[notificationSplashViewController.view removeFromSuperview];
[navController popToRootViewControllerAnimated:NO];
[navController pushViewController:notificationSplashViewController animated:YES];

for me, this did the trick.