Forked from gimenete/gist:53704124583b5df3b407
Last active
December 30, 2016 09:04
-
-
Save ricardopereira/6eb57b5f8b68372afd503b98e97d6d78 to your computer and use it in GitHub Desktop.
Animated rootViewController transition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// put this in your AppDelegate | |
- (void)changeRootViewController:(UIViewController*)viewController { | |
if (!self.window.rootViewController) { | |
self.window.rootViewController = viewController; | |
return; | |
} | |
UIView *snapShot = [self.window snapshotViewAfterScreenUpdates:YES]; | |
[viewController.view addSubview:snapShot]; | |
self.window.rootViewController = viewController; | |
[UIView animateWithDuration:0.3 animations:^{ | |
snapShot.layer.opacity = 0; | |
snapShot.layer.transform = CATransform3DMakeScale(1.5, 1.5, 1.5); | |
} completion:^(BOOL finished) { | |
[snapShot removeFromSuperview]; | |
}]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment