我有一个UICollectionView
显示从 Internet 下载的图像网格的地方。我正在使用SDWebImage
加载图像。我面临的问题是,当我滚动浏览时UICollectionView
,有时单元格会重复自己,显示相同的图像。但是当单元格滚动到视野之外然后又被带回来时,它具有正确的图像集。
-(UICollectionViewCell*) collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
NSString *CellIdentifier = @"Gallery_Cell";
GalleryCell *cell;
if (cell==nil) {
cell= (GalleryCell *)[self.flowCollection dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath];
ImageItem *dets = [self.imageList objectAtIndex:indexPath.row];
NSURL *mainImageURL = [NSURL URLWithString:dets.smallImageURL];
cell.image.contentMode = UIViewContentModeScaleAspectFill;
cell.image.clipsToBounds = YES;
[cell.image setImageWithURL:mainImageURL placeholderImage:nil];
}
return cell;
}
这有发生在其他人身上吗?非常感谢任何指针。