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];

Source