首页 > Web开发 > 详细

SDWebImage4.0之后加载gif不显示的解决方案

时间:2019-11-06 11:16:57      阅读:107      评论:0      收藏:0      [点我收藏+]

SDWebImage4.0之前

1     UIImageView *imgView = [UIImageView new];
2     imgView.contentMode = UIViewContentModeScaleAspectFit;
3     imgView.frame = CGRectMake(0, 0, 100, 30);
4     
5     NSString  *filePath = [[NSBundle bundleWithPath:[[NSBundle mainBundle] bundlePath]]pathForResource:@"going" ofType:@"gif"];
6     NSData  *imageData = [NSData dataWithContentsOfFile:filePath];
7     imgView.backgroundColor = [UIColor clearColor];
8     imgView.image = [UIImage sd_animatedGIFWithData:imageData];
9     [self addSubview:imgView];

SDWebImage4.0之后

1     FLAnimatedImageView *imgView = [FLAnimatedImageView new];
2     imgView.contentMode = UIViewContentModeScaleAspectFit;
3     imgView.frame = CGRectMake(0, 0, 100, 30);
4     NSString  *filePath = [[NSBundle bundleWithPath:[[NSBundle mainBundle] bundlePath]]pathForResource:@"going" ofType:@"gif"];
5     NSData  *imageData = [NSData dataWithContentsOfFile:filePath];
6     imgView.backgroundColor = [UIColor clearColor];
7     imgView.animatedImage = [FLAnimatedImage animatedImageWithGIFData:imageData];
8     [self addSubview:imgView];

 

SDWebImage4.0之后加载gif不显示的解决方案

原文:https://www.cnblogs.com/liuzhi20101016/p/11803942.html

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