- (IBAction)rotate:(id)sender {
CABasicAnimation* rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.delegate = self;
rotationAnimation.fromValue = @(0);
rotationAnimation.toValue = @(20);
rotationAnimation.duration = 2.0f;
rotationAnimation.autoreverses = NO;
rotationAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
rotationAnimation.removedOnCompletion = NO;
rotationAnimation.fillMode = kCAFillModeBoth;
[_rotateView.layer addAnimation:rotationAnimation forKey:@"revItUpAnimation"];
}原文地址:http://blog.csdn.net/rainlesvio/article/details/38231193