UICollectionView
インターネットからダウンロードした画像のグリッドを表示する場所があります。私は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;
}
これは他の誰かに起こりましたか?ポインタをいただければ幸いです。