-
-
Save hungeric/a557ac29e855b4f96454be8d0756ee41 to your computer and use it in GitHub Desktop.
Animated rootViewController transition
This file contains hidden or 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