Created
November 10, 2013 17:59
-
-
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.
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 "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