一、FLAnimatedImage is a performant animated GIF engine for iOS:
①同时播放多个GIF,播放速度可与桌面浏览器相媲美
②可变帧延迟
③Behaves gracefully under memory pressure
④消除第一次播放循环期间的延迟或阻塞
⑤以与现代浏览器相同的方式解释快速GIF的帧延迟
二、为什么应用FLAnimatedImage?
*尚不支持GIF动画的应用
*已支持动画GIF但需要更高性能解决方案的应用
*People who want to tinker with the code (the corresponding blog postis a great place to start; also see theTo Dosection below)
三、使用方法
FLAnimatedImage是一个封装良好的插入组件。只需使用FLAnimatedImageView实例替换您的UIImageView实例即可获得动画GIF支持。没有要管理的中央缓存或状态。
pod'FLAnimatedImage','~> 1.0'
FLAnimatedImage *image = [FLAnimatedImageanimatedImageWithGIFData:[NSDatadataWithContentsOfURL:[NSURLURLWithString:@"https://upload.wikimedia.org/wikipedia/commons/2/2c/Rotating_earth_%28large%29.gif"]]];
FLAnimatedImageView *imageView = [[FLAnimatedImageViewalloc]init]
;imageView.animatedImage = image;imageView.frame = CGRectMake(0.0,0.0,100.0,100.0);
[self.viewaddSubview:imageView];
详细使用方式见:github地址