Search code examples
objective-ciosxcodecocoa-touch

RootViewController Switch Transition Animation


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


Solution

  • 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];