图片绕中心做圆周运动

//创建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];

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • (一)Masonry介绍 Masonry是一个轻量级的布局框架 拥有自己的描述语法 采用更优雅的链式语法封装自动布...
    木易林1阅读 7,046评论 0 3
  • Masonry是一个轻量级的布局框架,拥有自己的描述语法,采用更优雅的链式语法封装自动布局,简洁明了并具有高可读性...
    3dcc6cf93bb5阅读 5,813评论 0 1
  • iOS_autoLayout_Masonry 概述 Masonry是一个轻量级的布局框架与更好的包装AutoLay...
    指尖的跳动阅读 4,946评论 1 4
  • 一、前言 关于苹果的布局一直是我比较纠结的问题,是写代码来控制布局,还是使用storyboard来控制布局呢?以前...
    iplaycodex阅读 7,184评论 0 1
  • 今年72岁了,身体健康状况良好,牙好胃口好,没事公园里散步。我喜欢养鸟,老家带来的画眉鸟,平时没事就带出去...
    喜羊羊是狼哥哥阅读 1,729评论 0 0