Projects sometimes encounter the use of UIView to add animation, here I think it is better to add animation on the layer, because you can set the animation properties in detail to facilitate understanding
Here is a rotation animation:
-(void) Roundbtnaction: (ID) Sender {
UIButton * Button = (UIButton *) sender;
Animation self-rotation (layer animation):
cabasicanimation* rotationanimation;
Rotationanimation = [cabasicanimation animationwithkeypath:@ "Transform.rotation.z"];
Rotationanimation.tovalue = [NSNumber numberwithfloat:m_pi * 1];
[Camediatimingfunction Functionwithname:kcamediatimingfunctioneaseineaseout];
Rotationanimation.duration = 1;
Rotationanimation.repeatcount = 0;//You can set to the maximum integer value
Rotationanimation.cumulative = NO;
Rotationanimation.removedoncompletion = NO;
Rotationanimation.fillmode = Kcafillmodeforwards;
[Button.layer addanimation:rotationanimation Forkey: @ "Rotation"];
}
Original: http://www.cnblogs.com/A--G/p/4679316.html
Add a UIView animation with a layer