FLAnimatedImage

简介:

FLAnimatedImage

FLAnimatedImage is a performant animated GIF engine for iOS:

FLAnimatedImage是一个播放gif图片的引擎:

  • Plays multiple GIFs simultaneously with a playback speed comparable to desktop browsers 可以异步播放多个gif图片,不会降低速度,与电脑上面播放的效果一致.
  • Honors variable frame delays 支持帧率的不同
  • Behaves gracefully under memory pressure 内存占用率小
  • Eliminates delays or blocking during the first playback loop 重复播放时,不会有延时阻塞感
  • Interprets the frame delays of fast GIFs the same way modern browsers do 

It's a well-tested component that powers all GIFs in Flipboard. To understand its behavior it comes with an interactive demo:

 这个已经经过了很多的测试,保证很稳定。你可以看看下面demo显示:

 

 

Who is this for? 用在什么地方?

  • Apps that don't support animated GIFs yet App还不支持GIF显示的
  • Apps that already support animated GIFs but want a higher performance solution App已经使用了GIF图片,但是效果不好的
  • People who want to tinker with the code (the corresponding blog post is a great place to start; also see the To Do section below) 那些想要改进这份代码的人

 

Installation & Usage

FLAnimatedImage is a well encapsulated drop-in component. Simply replace your UIImageView instances with instances of FLAnimatedImageView to get animated GIF support. There is no central cache or state to manage.

FLAnimatedImage是一个继承与UIImageView的子类,你只需要简单的用FLAnimatedImage替换UIImageView即可支持GIF图片的显示。没有中心缓存或者是状态管理操作。

If using CocoaPods, the quickest way to try it out is to type this on the command line:

如果你使用CocoaPods,你可以用以下一句话来集成:

$ pod try FLAnimatedImage

To add it to your app, copy the two classes FLAnimatedImage.h/.m and FLAnimatedImageView.h/.minto your Xcode project or add via CocoaPods by adding this to your Podfile:

你也可以将FLAnimatedImage.h/.m 与 FLAnimatedImageView.h/.m拷贝到你的项目中即可。

pod 'FLAnimatedImage', '~> 1.0'

In your code, #import "FLAnimatedImage.h", create an image from an animated GIF, and setup the image view to display it:

在你的代码中,导入 #import "FLAnimatedImage.h",然后创建出GIF图片,加载出来显示即可:

FLAnimatedImage *image = [FLAnimatedImage animatedImageWithGIFData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://raphaelschaad.com/static/nyan.gif"]]]; FLAnimatedImageView *imageView = [[FLAnimatedImageView alloc] init]; imageView.animatedImage = image; imageView.frame = CGRectMake(0.0, 0.0, 100.0, 100.0); [self.view addSubview:imageView];

It's flexible to integrate in your custom image loading stack and backwards compatible to iOS 6.

兼容性很好,即时是iOS6也能跑的很顺畅。

It uses ARC and the Apple frameworks QuartzCoreImageIOMobileCoreServices, andCoreGraphics.

使用ARC,以及QuartzCore,ImageIO,MobileCoreServices,andCoreGraphics框架

It has fine-grained logging. By default, it uses NSLog. However, if your project usesCocoaLumberjack, it automatically can detect that and use CocoaLumberjack to send logs to the configured output.

Since FLAnimatedImage is licensed under MIT, it's compatible with the terms of using it for any app on the App Store.

 

To Do

  • Support other animated image formats such as APNG or WebP
  • Integration into network libraries and image caches
  • Investigate whether FLAnimatedImage should become a UIImage subclass
  • Smarter buffering
  • Bring demo app to iOS 6 and iPhone

This has successfully shipped to many people as is, but please do come with your questions, issues and pull requests!

Feel free to reach out to @RaphaelSchaad for further help.

 

Select apps using FLAnimatedImage

Using FLAnimatedImage in your app? Let me know!

目录
相关文章
|
机器学习/深度学习 计算机视觉
Mobile-Unet网络综述
Mobile-Unet网络综述
1091 0
Mobile-Unet网络综述
|
Android开发
获取APP版本号:versionName、versionCode---Android基础篇
获取APP版本号:versionName、versionCode---Android基础篇
1958 0
|
Swift iOS开发 Perl
如何解决Swift混编的module编译错误
前言很多iOS工程都是基于Object-C开发,再逐步向Swift演进,演进过程中不可避免要进行Swift混编。Swift模块需要支持LLVM Module规范,混编工程会遇到各种Module编译错误。这对于不熟悉的同学来说简直是灾难,严重影响开发效率。本文会介绍常见的Module编译错误,希望对大家有所帮助。常见错误1:Could not build module xxx当一个OC模块引用了Sw
5334 1
如何解决Swift混编的module编译错误
|
域名解析 Java Apache
Maven 公共代理库
Maven 公共仓库提供了对 maven central、jcenter、google、spring 等常用的 Maven 仓库的镜像功能。用户可以通过页面浏览仓库内容、检索和下载制品。在构建时使用 Maven 个公共仓库地址下载制品速度更快,更稳定。
47023 1
Maven 公共代理库
|
Python
python setup.py bdist_wheel 报错的处理办法
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: setup.py --help [cmd1 cmd2 .
12239 0
|
Android开发 iOS开发
|
数据库 iOS开发 数据库管理
|
8天前
|
NoSQL Cloud Native Redis
Redis核心开发者的新征程:阿里云与Valkey社区的技术融合与创新
阿里云瑶池数据库团队后续将持续参与Valkey社区,如过往在Redis社区一样耕耘,为开源社区作出持续贡献。
Redis核心开发者的新征程:阿里云与Valkey社区的技术融合与创新
|
7天前
|
关系型数据库 分布式数据库 数据库
PolarDB闪电助攻,《香肠派对》百亿好友关系实现毫秒级查询
PolarDB分布式版助力《香肠派对》实现百亿好友关系20万QPS的毫秒级查询。
PolarDB闪电助攻,《香肠派对》百亿好友关系实现毫秒级查询
|
9天前
|
消息中间件 Cloud Native Serverless
RocketMQ 事件驱动:云时代的事件驱动有啥不同?
本文深入探讨了云时代 EDA 的新内涵及它在云时代再次流行的主要驱动力,包括技术驱动力和商业驱动力,随后重点介绍了 RocketMQ 5.0 推出的子产品 EventBridge,并通过几个云时代事件驱动的典型案例,进一步叙述了云时代事件驱动的常见场景和最佳实践。
115101 1