其实网上GitHub有很多第三方的,但是用起来比较麻烦,这里介绍最简单的一种方式,,(点击按钮开始播放动态图)
1,集成SDWebImage之后,引入头文件#import "UIImage+GIF.h"
2.初始化按钮,(loadingImageView是定义的全局的UIImageView,自己顶一下)
self.loadingImageView= [[UIImageView alloc]init];
UIButton* btn=[[UIButton alloc]initWithFrame:CGRectMake(0, 100, 50, 20)];
btn.backgroundColor=[UIColor redColor];
[self.view addSubview:btn];