Created
December 4, 2011 04:01
-
-
Save neilang/1429111 to your computer and use it in GitHub Desktop.
Spin Segue
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
#import "NASpinSegue.h" | |
@implementation NASpinSegue | |
- (void)perform{ | |
UIViewController *sourceViewController = (UIViewController *)self.sourceViewController; | |
UIViewController *destinationViewController = (UIViewController *)self.destinationViewController; | |
CGAffineTransform scale = CGAffineTransformScale(CGAffineTransformIdentity, 0.01, 0.01); | |
CGAffineTransform rotate = CGAffineTransformRotate(CGAffineTransformIdentity, -M_PI); | |
[UIView animateWithDuration:1.0f delay:0.0f options:UIViewAnimationOptionAllowUserInteraction animations:^{ | |
sourceViewController.view.transform = CGAffineTransformConcat(rotate, scale); | |
} completion:^(BOOL finished){ | |
[sourceViewController presentModalViewController:destinationViewController animated:NO]; | |
destinationViewController.view.transform = CGAffineTransformConcat(rotate, scale); | |
[UIView beginAnimations:nil context:NULL]; | |
[UIView setAnimationDuration:0.9]; | |
destinationViewController.view.transform = CGAffineTransformIdentity; | |
[UIView commitAnimations]; | |
}]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment