Created
January 30, 2015 09:57
-
-
Save peerax/8784e04700499c3499b3 to your computer and use it in GitHub Desktop.
ios custom 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
- (void)perform { | |
UIViewController *sourceViewController = self.sourceViewController; | |
UIViewController *destinationViewController = self.destinationViewController; | |
// Add the destination view as a subview, temporarily | |
[sourceViewController.view addSubview:destinationViewController.view]; | |
// Transformation start scale | |
destinationViewController.view.transform = CGAffineTransformMakeScale(0.05, 0.05); | |
// Store original centre point of the destination view | |
CGPoint originalCenter = destinationViewController.view.center; | |
// Set center to start point of the button | |
destinationViewController.view.center = self.originatingPoint; | |
[UIView animateWithDuration:0.5 | |
delay:0.0 | |
options:UIViewAnimationOptionCurveEaseInOut | |
animations:^{ | |
// Grow! | |
destinationViewController.view.transform = CGAffineTransformMakeScale(1.0, 1.0); | |
destinationViewController.view.center = originalCenter; | |
} | |
completion:^(BOOL finished){ | |
[destinationViewController.view removeFromSuperview]; // remove from temp super view | |
[sourceViewController presentViewController:destinationViewController animated:NO completion:NULL]; // present VC | |
}]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment