Skip to content

Instantly share code, notes, and snippets.

@neilang
Created December 4, 2011 04:01
Show Gist options
  • Save neilang/1429111 to your computer and use it in GitHub Desktop.
Save neilang/1429111 to your computer and use it in GitHub Desktop.
Spin Segue
#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