自定义的图片实现旋转的动画

2015-12-14  本文已影响123人  super_lian

自定义的图片实现旋转的动画

、、、

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
上一篇 下一篇

猜你喜欢

热点阅读