RootViewController Switch Transition Animation

Jefferson picture Jefferson · Oct 9, 2011 · Viewed 49.4k times · Source

Is there any way to have a Transition/animation effect while replacing an existing viewcontroller as rootviewcontroller with a new one in the appDelegate?

Answer

Ole Begemann picture Ole Begemann · Oct 9, 2011

You can wrap the switching of the rootViewController in a transition animation block:

[UIView transitionWithView:self.window
                  duration:0.5
                   options:UIViewAnimationOptionTransitionFlipFromLeft
                animations:^{ self.window.rootViewController = newViewController; }
                completion:nil];