APLImageCache
FastImageCache 的简单封装。
- 易于设置
- 提供 UIImageView 类别以请求和取消请求。
- 支持自定义图像下载类。
安装
通过在 Podfile 中添加以下内容进行安装
pod "APLImageCache", "~> 0.0.5"
使用
导入头文件
#import <APLImageCache/APLImageCache.h>
设置
一个缓存两种类型图像的示例(用户照片和书封面)
NSDictionary *coverDescription = @{ APLImageType : @"bookCover", APLImageWidth : @90, APLImageHeight : @135 };
NSDictionary *photoDescription = @{ APLImageType : @"userPhoto", APLImageWidth : @50, APLImageHeight : @50 };
[APLImageCache setupWithDownloader:nil descriptions:@[coverDescription, photoDescription]];
最适合这个的是 AppDelegate 中的 'application:didFinishLaunchingWithOptions:' 方法。
请求
[self.imageView requestImageWithURL:book.coverURL type:@"bookCover" placeholder:placeholder];
取消
[self.imageView cancelImageRequest];