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!

[翻译] FLAnimatedImage的更多相关文章

  1. 《Django By Example》第五章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者@ucag注:大家好,我是新来的翻译, ...

  2. 《Django By Example》第四章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:祝大家新年快乐,这次带来<D ...

  3. [翻译]开发文档:android Bitmap的高效使用

    内容概述 本文内容来自开发文档"Traning > Displaying Bitmaps Efficiently",包括大尺寸Bitmap的高效加载,图片的异步加载和数据缓存 ...

  4. 【探索】机器指令翻译成 JavaScript

    前言 前些时候研究脚本混淆时,打算先学一些「程序流程」相关的概念.为了不因太枯燥而放弃,决定想一个有趣的案例,可以边探索边学. 于是想了一个话题:尝试将机器指令 1:1 翻译 成 JavaScript ...

  5. 《Django By Example》第三章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:第三章滚烫出炉,大家请不要吐槽文中 ...

  6. 《Django By Example》第二章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:翻译完第一章后,发现翻译第二章的速 ...

  7. 《Django By Example》第一章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:本人目前在杭州某家互联网公司工作, ...

  8. 【翻译】Awesome R资源大全中文版来了,全球最火的R工具包一网打尽,超过300+工具,还在等什么?

    0.前言 虽然很早就知道R被微软收购,也很早知道R在统计分析处理方面很强大,开始一直没有行动过...直到 直到12月初在微软技术大会,看到我软的工程师演示R的使用,我就震惊了,然后最近在网上到处了解和 ...

  9. ASP.NET MVC with Entity Framework and CSS一书翻译系列文章之第一章:创建基本的MVC Web站点

    在这一章中,我们将学习如何使用基架快速搭建和运行一个简单的Microsoft ASP.NET MVC Web站点.在我们马上投入学习和编码之前,我们首先了解一些有关ASP.NET MVC和Entity ...

随机推荐

  1. happy in java之io流简介

    闲来没事,重温马士兵老师的java基础... 流  水流的流  流氓的流,,流 英文叫做stream,溪流 流的分类: 流是用来读写数据的. 流就像水流一样,File类封装的是文件的名字,它是内存里头 ...

  2. Jmeter创建一个点对点的 JMS 测试计划

    创建一个点对点的 JMS 测试计划 确保所需的jar文件位于JMeter lib目录中. 如果没有,关闭JMeter,复制jar文件并重新启动JMeter. 参见详细教程 在本节中,将学习如何创建测试 ...

  3. 对 BOIS 的一些介绍

    BIOS里不可调节CPU将在64/32位系统下工作 知识点延伸1,一般CPU要想在64位状态下运行必须具备两个条件: 1)安装64位操作系统 2)CPU本身就支持64位指令集 知识点延伸2有必要了解B ...

  4. SharePoint如何创建能够继承站点左面导航(Left Navigation)的Web Part页面

    转自:http://social.msdn.microsoft.com/Forums/zh-CN/b069e6f8-e4d5-4bf3-93a1-4eecb55489d6/sharepointleft ...

  5. JAVA练手--线程(Thread)

    1. 查看线程是否还存活 package tet;public class kk extends Thread{ //1. 查看线程是否还存活 public void run(){ for(int i ...

  6. jpages中文api

    需要引入的文件 :   containerID 字符串 默认值: 必需!(无默认值) 要分页的项目的容器ID.它可以是UL,OL,DIV等.    first  String || 假 默认值: fa ...

  7. 第8天:javascriptDOM小 案例、onmouseover 、onmouseout

    案例 为元素注册点击事件,弹出对话框 <input type="button" id="btn" value="开发分离"> & ...

  8. nodejs初印象

    初学Nodejs,特意在此记录学习过程,算是对这段时间的一个summary吧,相互勉励,共同进步嘛,Now Begin: 1.什么是nodejs nodejs 是一种基于事件驱动.非阻塞I/O模型,用 ...

  9. Cookie写入之path的坑

    问题 我在/page/index/index.html中向浏览器添加了一个useid的cookie(这里没有指定path), 然后试着从/page/demo/demo.html中取值,发现无法取到, ...

  10. JSP9大内置对象

    JSP9大内置对象 JSP9个内置对象:out对象 用于输出各种数据reuest对象 封装了来自客户端的各种信息response对象 封装了服务器的响应信息exception对象 封装了程序运行过程中 ...