繁体   English   中英

SDWebImage拇指+原始图像加载问题

[英]SDWebImage thumb + original image loading issue

我正在尝试先加载缩略图,然后请求图像的原始版本,但未获得对原始图像请求的响应。

[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
            }

        }];

    }
}];

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM