SDWebImage downloadImageWithURL 换成loadImageWithURL

2021-12-16 09:32:06 浏览数 (1)

由于没有注意到SDWebImage新版本Api的变化,今天使用SDWebImageManager 下载图片的方法,记得之前的Api是downloadImageWithURL、新版本变成了loadImageWithURL,记录一下。

代码语言:javascript复制
//老版本
 [[SDWebImageManager sharedManager]downloadImageWithURL:[NSURL URLWithString:@""] options:0 progress:^(NSInteger receivedSize, NSInteger expectedSize) {
 } completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
}];

//4.0 版本
[[SDWebImageManager sharedManager] loadImageWithURL:[NSURL URLWithString:[imageArray objectAtIndex:i]] options:0 progress:^(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL) {
 } completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {
}];

0 人点赞