当我使用方法加载图像时,下载图像后,直到我选择或滚动单元格时才显示,但如果我没有将placeholderImage设置为零,则效果很好。我不知道有什么问题。这里是我的代码:SDWebImage的一些问题
[cell.imageView sd_setImageWithURL:(my url) placeholderImage:nil];
与SDWebImage一些问题
当我使用方法加载图像时,下载图像后,直到我选择或滚动单元格时才显示,但如果我没有将placeholderImage设置为零,则效果很好。我不知道有什么问题。这里是我的代码:SDWebImage的一些问题
[cell.imageView sd_setImageWithURL:(my url) placeholderImage:nil];
与SDWebImage一些问题
这很奇怪,但你可以在您尝试[cell setNeedsLayout];
设置图像以重新加载所有单元格视图。
我猜你有内部tableView:cellForRowAtIndexPath:
你很好,当我使用这个方法时,它工作的很好:'[cell.imageView sd_setImageWithURL:[NSURL URLWithString:@“http:// pic2。 ooopic.com/01/03/51/25b1OOOPIC19.jpg“] placeholderImage:nil completed:^(UIImage * image,NSError * error,SDImageCacheType cacheType,NSURL * imageURL){cell layoutSubviews]; }];' – hmxxxhhh
但我仍然不知道为什么,如果placeholderImage不为零,即使没有代码[cell layoutSubviews],它也能正常工作。 – hmxxxhhh
完工块的所有调用来改变图像视图。
[myImage sd_setImageWithURL:[NSURL URLWithString:url] placeholderImage:[UIImage imageNamed:IMG_PLACEHOLDER] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {}];
在您的项目中使用它并尝试。
谢谢,我应该在代码里面填写'[cell layoutSubviews]'完成块。 – hmxxxhhh
你可以尝试把这个方法放在main_queue上吗? –
我用过SDWebImage,我看过他的代码,他用过(dispathch_main_aync_safe) – hmxxxhhh
@CongTran我只试过了cell.imageView有问题 – hmxxxhhh