Skip to content

Instantly share code, notes, and snippets.

@tonyarnold
Forked from neilang/NASpinSegue.m
Created December 4, 2011 04:09
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonyarnold/1429128 to your computer and use it in GitHub Desktop.
Save tonyarnold/1429128 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(scale, -M_PI * 2.0);
[UIView animateWithDuration:1.0f delay:0.0f options:UIViewAnimationOptionAllowUserInteraction animations:^{
sourceViewController.view.transform = rotate;
} completion:^(BOOL finished){
[sourceViewController presentModalViewController:destinationViewController animated:NO];
destinationViewController.view.transform = rotate;
[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