Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haifengkao/7401549 to your computer and use it in GitHub Desktop.
Save haifengkao/7401549 to your computer and use it in GitHub Desktop.
To animate a view whose size is (40,60) from point (0,10) to point (300,300), while flipping its view on the y axis (horizontal flip of 180 degrees), and the size changing to (20,30). As requested by Anil.
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[self performSelector:@selector(beginTransition) withObject:nil afterDelay:2.0];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
// (40,60) from point (0,10) to point (300,300)
self.view.frame = CGRectMake(0.0, 10.0, 40.0, 60.0);
}
- (void)beginTransition
{
CGFloat scaleSpeed = 10.0;
[UIView transitionWithView:self.view
duration:scaleSpeed
options:UIViewAnimationOptionTransitionFlipFromLeft
// (40,60) from point (0,10) to point (300,300)
// the size changing to (20,30)
animations:^{ self.view.frame = CGRectMake(300.0, 300.0, 20.0, 30.0);}
completion:NULL];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment