1、首先需要在podfile里面安装依赖
pod 'SDWebImage'
pod 'SDWebImage/GIF'
2、代码如下:
// 引入头文件
#import "FLAnimatedImageView+WebCache.h"
// 显示GIF图片
FLAnimatedImageView *bannerImageView = [FLAnimatedImageView new];
bannerImageView.contentMode = UIViewContentModeScaleAspectFit;
bannerImageView.frame = CGRectMake(0, 0, kScreenWidth, headerViewHeight);
NSString *filePath = [[NSBundle bundleWithPath:[[NSBundle mainBundle] bundlePath]]pathForResource:@"MECoinbanner" ofType:@"gif"];
NSData *imageData = [NSData dataWithContentsOfFile:filePath];
bannerImageView.backgroundColor = [UIColor clearColor];
bannerImageView.animatedImage = [FLAnimatedImage animatedImageWithGIFData:imageData];
[_tableHeaderView addSubview:bannerImageView];
本文介绍如何通过Pod安装SDWebImage及其GIF扩展,并展示如何利用FLAnimatedImageView加载并显示本地GIF图片。
4969

被折叠的 条评论
为什么被折叠?



