自定义的图片实现旋转的动画
、、、
self.hudImageView = [[UIImageView alloc] init];
[self.hudImageView setImage:SLImageName(@"loading")];
[self addSubview:self.hudImageView];
CABasicAnimation* rotationAnimation;
rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 ];
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
rotationAnimation.duration = 2;
rotationAnimation.repeatCount = FLT_MAX;//你可以设置到最大的整数值
rotationAnimation.cumulative = NO;
rotationAnimation.removedOnCompletion = NO;
rotationAnimation.fillMode = kCAFillModeForwards;
[self.hudImageView.layer addAnimation:rotationAnimation forKey:@"Rotation"];
、、、
DDA3335B-FE13-4577-A179-12C547242455.png
网友评论