例如封装请求时,自定义一个图片旋转的提示框,
代码:
CABasicAnimation* rotationAnimation;
//绕哪个轴,那么就改成什么:这里是绕z轴 ---> transform.rotation.z
rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
//旋转角度
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI];
//每次旋转的时间(单位秒)
rotationAnimation.duration = 1;
rotationAnimation.cumulative = YES;
rotationAnimation.removedOnCompletion = NO;
//重复旋转的次数,如果你想要无数次,那么设置成MAXFLOAT
rotationAnimation.repeatCount = MAXFLOAT;
[self.imageView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
中心的图片会一直旋转