首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SDWebImage thumb +原始图像加载问题

SDWebImage thumb +原始图像加载问题
EN

Stack Overflow用户
提问于 2015-10-21 20:41:38
回答 2查看 562关注 0票数 0

我正在尝试加载缩略图图像首先,然后请求原始版本的图像,但没有得到响应的原始图像请求。

代码语言:javascript
复制
[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;
                }

            }];
        }
    }
}];

谢谢..

EN

回答 2

Stack Overflow用户

发布于 2015-10-21 21:01:34

试一下这个案例

代码语言:javascript
复制
[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){
            }];
        }
    }
}];

这一条:

代码语言:javascript
复制
[[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");
                                                                                              }];
                                                          }
                                                      }];
票数 0
EN

Stack Overflow用户

发布于 2015-10-23 16:56:57

我用以下代码解决了我的问题

代码语言:javascript
复制
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
            }

        }];

    }
}];
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33259611

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档