【发布时间】:2014-02-03 16:15:12
【问题描述】:
在我的方法 cellForItemAtIndexPath 我有这个代码:
SDWebImageManager *manager = [SDWebImageManager sharedManager];
[manager downloadWithURL:[NSURL URLWithString:coverURL] options:0 progress:^(NSInteger receivedSize, NSInteger expectedSize) {
} completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished) {
RRRBigItemCell *cell = (RRRBigItemCell *)[collectionView cellForItemAtIndexPath:indexPath];
if (cell) {
RRRImageView *coverView = (RRRImageView *)[cell viewWithTag:COVER_TAG];
coverView.image = image;
}
}];
当我启动应用程序并向下滚动时,一切正常。但是当我向上滚动时,已经显示的单元格没有加载图像(单元格 == nil)。如果我再次向下滚动,问题仍然存在于已显示的单元格中,只有新的单元格已加载图像。 知道我做错了什么吗?
【问题讨论】:
标签: ios objective-c lazy-loading uicollectionview sdwebimage