Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ricardopereira/6eb57b5f8b68372afd503b98e97d6d78 to your computer and use it in GitHub Desktop.
Save ricardopereira/6eb57b5f8b68372afd503b98e97d6d78 to your computer and use it in GitHub Desktop.
Animated rootViewController transition
// 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