Ios SDWebImage thumb+;原始图像加载问题
我正在尝试先加载缩略图图像,然后请求原始图像版本,但没有得到原始图像请求的响应Ios SDWebImage thumb+;原始图像加载问题,ios,objective-c,ios9,sdwebimage,Ios,Objective C,Ios9,Sdwebimage,我正在尝试先加载缩略图图像,然后请求原始图像版本,但没有得到原始图像请求的响应 [imageView sd_setImageWithURL:thumbUrl completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { if (image) { imageView.image = image; if (originalUrl !=
[imageView sd_setImageWithURL:thumbUrl completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
if (image) {
imageView.image = image;
if (originalUrl != nil) {
[imageView sd_setImageWithURL:originalUrl placeholderImage:image completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL){
if (image) {
imageView.image = image;
}
}];
}
}
}];
谢谢。试试这个案子
[imageView sd_setImageWithURL:thumbUrl completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
if (originalUrl != nil) {
[imageView sd_setImageWithURL:originalUrl placeholderImage:image completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL){
}];
}
}
}];
这个:
[[SDWebImageManager sharedManager] downloadImageWithURL:[NSURL URLWithString:path]
options:nil
progress:nil
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
if (image)
{
[self.artworkImageView sd_setImageWithURL:[NSURL URLWithString:path2] placeholderImage:image
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
if (image)
NSLog(@"magic");
}];
}
}];
我用下面的代码解决了我的问题
UIImageView * hiddenImageView = [[UIImageView alloc] init];
[hiddenImageView sd_setImageWithURL:thumbUrl completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
if (image) {
mImageView.image = image;
}
if (originalUrl != nil) {
[mImageView sd_setImageWithURL:originalUrl placeholderImage:image completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL){
if (image) {
mImageView.image = image; // optional
}
}];
}
}];
如果image为nil,我希望将错误传递到completion块。您是否检查了
错误
?我已经检查了,第二次请求没有得到任何响应。完成处理程序中的请求是否有任何问题?首先,您不应该将image设置为imageViewimageView.image=image代码>将自动完成。@Che我同意,但这与我的问题有什么关系。事实上,我检查了两个变体…你和我的…一切都正常…你确定在第二次调用sd\u setImageWithURL
时吗?我的意思是,originalURL不是零。我找不到任何区别。好吧,如果你不喜欢这个变体,你可以试试另一个。补充到我的评论中。