Spin UI Object, animation rotate 360 Degree
Categories: iPhone, Mac OS X on Dec.09, 2009
Rotate object / image 360 degrees on iphone
For anyone following along, you’ll need to add the QuartzCore Framework to your project and include the
1 | #import <QuartzCore/QuartzCore.h> |
Add animation for object:
1 2 3 4 5 6 | CABasicAnimation *fullRotation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"]; fullRotation.fromValue = [NSNumber numberWithFloat:0]; fullRotation.toValue = [NSNumber numberWithFloat:((360*M_PI)/180)]; fullRotation.duration = 6; fullRotation.repeatCount = 1e100f; [myview.layer addAnimation:fullRotation forKey:@"360"]; |
Remove all animations for object:
1 | [myview.layer removeAllAnimations]; |
Similar posts:
January 16th, 2011 on 10:08 pm
Thanks man I spent alot of time looking for that code :)
Thanks again :D
October 15th, 2011 on 4:03 am
Sorry but I would like to ask about additional settings in h. And how to make it work in Xcode 4.0.2.. unavailable !
Thanks.
October 15th, 2011 on 4:12 am
Sorry QuartzCore unavailable in Xcode 4.0.2
Thanks