NSURL *url = [NSURL URLWithString: [photo.largeImageURL.absoluteString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]];
[_imageView sd_setImageWithURL:url placeholderImage:photo.thumbImage options:SDWebImageRetryFailed|SDWebImageScaleDownLargeImages|SDWebImageRefreshCached progress:^(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL) {
dispatch_async(dispatch_get_main_queue(), ^{
CGFloat progress = (CGFloat)receivedSize / (CGFloat)expectedSize;
if (photo.progressUpdateBlock) {
photo.progressUpdateBlock(photo, progress);
}
});
} completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
dispatch_async(dispatch_get_main_queue(), ^{
if (image) {
// Successful load
if ([self.photo.largeImageURL.absoluteString isEqualToString:imageURL.absoluteString]) {
[self hideProgressView];
self.photo.originalImage = image;
[self resizeSubviewsSize];
}
} else {
// Failed to load
[self hideProgressView];
}
});
}];
SDWebImage加载超高清大图 显示不出来问题处理
最新推荐文章于 2025-02-20 14:52:55 发布