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

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];

 

posted on 2019-11-06 11:10  在一起的浅蓝色  阅读(334)  评论(0编辑  收藏  举报

导航