zl程序教程

您现在的位置是:首页 >  Python

当前栏目

SDWebImage downloadImageWithURL 换成loadImageWithURL

2023-04-18 15:00:45 时间

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

//老版本
 [[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) {
}];