图片绕中心做圆周运动

//创建UIImageView

self.imgViewLoading = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"ioading_50_1"]];

[_viewLoading addSubview:self.imgViewLoading];

[self.imgViewLoading mas_makeConstraints:^(MASConstraintMaker *make) {

make.size.mas_equalTo(CGSizeMake(150, 150));

make.centerX.equalTo(_viewLoading);

make.top.equalTo(_viewLoading.mas_top).with.offset(height + 10);

}];

//加载动画

CABasicAnimation *animation = [CABasicAnimation animation];

animation.keyPath = @"transform.rotation";

animation.duration = 1.0;

animation.repeatCount = INFINITY;

animation.byValue = @(M_PI * 2);

[self.imgViewLoading.layer addAnimation:animation forKey:nil];

//停止运动需要remove

[self.imgViewLoading.layer removeAllAnimations];

你可能感兴趣的:(图片绕中心做圆周运动)