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];
原文地址:https://www.cnblogs.com/liuzhi20101016/p/11803942.html