首页 > 移动平台 > 详细

iOS加载Gif图片

时间:2017-03-24 15:52:10      阅读:643      评论:0      收藏:0      [点我收藏+]

 

参考:

http://www.jianshu.com/p/f0530a75c7af


 https://github.com/Flipboard/FLAnimatedImage 

 

  

 

马蛋的一个加载的菊花不转了 

发现

   // NSString *path = [[NSBundle mainBundle] pathForResource:@"spin" ofType:@"gif"];
  //  NSData *data = [NSData dataWithContentsOfFile:path];
   // UIImage *image = [UIImage sd_animatedGIFWithData:data];

  //  cell.loadingImg.image=image;

这个不能用了  重要的是 :

sd的sd_animatedGIFWithData方法返回的image只包含第一帧。

 

找了新方法

使用FLAnimatedImageView。


#import <FLAnimatedImage/FLAnimatedImageView.h>


#import <FLAnimatedImage/FLAnimatedImage.h>



 NSString *path = [[NSBundle mainBundle] pathForResource:@"spin" ofType:@"gif"];

    NSData *data = [NSData dataWithContentsOfFile:path];

    FLAnimatedImage *image = [FLAnimatedImage animatedImageWithGIFData:data];

   

   FLAnimatedImageView *imageView = [FLAnimatedImageView new];

   

    imageView.animatedImage = image;


 

iOS加载Gif图片

原文:http://www.cnblogs.com/xuaninitial/p/6611628.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!