I am looking to run a segue to replace the window root window controller with another view controller using swirling animations. The idea is that I show the SplashViewController for a few seconds before moving on ( performSegueWithIdentifier: to the next one, LoginViewController , using the curl up animation.
I created my own UIStoryboardSegue class called AnimatedSegue . Here is the code for the overridden perform method:
- (void)perform { UIViewController *source = self.sourceViewController; UIViewController *destination = self.destinationViewController; UIWindow *window = source.view.window; [UIView transitionFromView:source.view toView:destination.view duration:1.0 options:UIViewAnimationOptionTransitionCurlUp completion:^(BOOL finished) { [window setRootViewController:destination]; }]; }
It works fine, except in iOS 6 (apparently not in iOS 5) the viewWillAppear: method viewWillAppear: is called twice on the destination view controller. It seems that he called the first time during the transition and the second time he executes [window setRootViewController:destination];
Please note that I do not want to use the navigation controller. SplashViewController freed up (as expected) after the transition is complete.
Any ideas on how to fix my problem?
Sylvain guillopé
source share