Created
June 8, 2011 23:12
-
-
Save adrienbrault/1015686 to your computer and use it in GitHub Desktop.
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
NSView *myView = ...; | |
myView.wantsLayer = YES; // The thing you must not forget. | |
CGPoint newPosition = CGPointMake(100.0, 200.0); | |
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position"]; | |
animation.fromValue = [NSValue valueWithPoint:myView.frame.origin]; | |
animation.toValue = [NSValue valueWithPoint:newPosition]; | |
animation.duration = 1.0; | |
[myView setFrameOrigin:newPosition]; | |
[myView.layer addAnimation:animation forKey:@"position"]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment