YLGIFImage 高效读取GIF图片
https://github.com/liyong03/YLGIFImage
Asynchronized GIF image class and Image viewer supporting play/stop GIF images.
异步加载GIF图片的类,支持GIF图片的播放与暂停。
It just use very less memory. Following GIF usually will cost almost 600MB memory if it is fully decoded (800x600x389x4 Bytes), but using YLGIFImage, it just use about 30MB memory.
它用的内存很少,完全解码GIF通常会消耗600MB的内存(800x600x389x4 Bytes),但是如果你用了YLGIFImage,它只占用30MB内存。
For this gif file, iOS Pinterest also will crash, but using YLGIFImage, it won't!
上面这张GIF图片。iOS加载时会直接崩溃,而使用了YLGIFImage,那就不会。
Using CocoaPods to get start, you can add following line to your Podfile:
使用CocoaPods安装:
pod 'YLGIFImage'
For using YLGIFImage, it's very simple:
使用YLGIFImage非常简单:
YLImageView* imageView = [[YLImageView alloc] initWithFrame:CGRectMake(0, 160, 320, 240)];
[self.view addSubview:imageView];
imageView.image = [YLGIFImage imageNamed:@"joy.gif"];
Here is the demo looks like:
以下是demo的截图:
Thanks
Thanks to OLImageView! I referred a lot to this project, especially using CADisplayLink to play the animation.
感谢 OLImageView !我从这个工程中引用了好多方法,尤其是使用CADisplayLink来显示动画