【发布时间】:2014-05-29 06:23:00
【问题描述】:
我正在使用 SDWebImage 库进行缓存和延迟加载。但我发现有时它会显示另一个单元格的图像。
细节场景
- CollectionView 的单元格包含 UIImageView 和 Labels。
- ImageView 包含用户的图像和带有他们的标签
名字。
但有时在 Imageview 中加载的图片会有不同的图片。
让我们说
Index Name Image
0 nameA A
1 nameB B
2 nameC C
3 nameD B
所以这里因为索引有 nameD,所以图像应该是 b“D”,但它显示的是 nameB 的图像,即“B”
这是我使用的代码
if ([aMutDict objectForKey:@"picture_url"])
{
[[SDWebImageManager sharedManager]downloadWithURL:[NSURL URLWithString:[aMutDict objectForKey:@"picture_url"]] options:SDWebImageProgressiveDownload progress:Nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished) {
if(image){
[cell.imgProfilePic setImage:image];
}else{
[cell.imgProfilePic setImage:ApplicationDelegate.gblImgPlaceholder];
}
}];
}
【问题讨论】:
标签: ios uiimageview sdwebimage image-caching