_loadingView = [[UIImageView
alloc]initWithFrame:CGRectMake(150,
300,
50, 50)];
_loadingView.image = [UIImage
imageNamed:@"22"];
[self.view
addSubview:_loadingView];
CABasicAnimation* rotationAnimation;
rotationAnimation = [CABasicAnimation
animationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.toValue = [NSNumber
numberWithFloat: M_PI *
2.0 ];
rotationAnimation.duration =
0.2;
rotationAnimation.cumulative =
YES;
rotationAnimation.repeatCount =
100000;
[_loadingView.layer
addAnimation:rotationAnimation
forKey:@"rotationAnimation"];//开始动画
_loadingView.layer removeAnimationForKey:<#(NSString *)#>//结束动画
版权声明:本文为博主原创文章,未经博主允许不得转载。
时间: 2024-10-14 07:38:15