UIImageView旋转动画

论坛 期权论坛 脚本     
匿名技术用户   2021-1-3 05:47   265   0

_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 *)#>//结束动画

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:7942463
帖子:1588486
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP