我想用自定义UICollectionViewCells实现侧滚动UICollectionView。每个自定义单元格都包含一个应填充单元格的UIImageView。现在我设置像这样的UIImageView的大小,如何使用填充单元格的UIImageView初始化自定义UICollectionViewCell?
-(UICollectionViewCell*)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
static NSString *cellID = @"cellID";
THCVCell* cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellID forIndexPath:indexPath];
cell.imageView.image = [self.images objectAtIndex:(indexPath.row % [self.images count])];
cell.imageView.frame = cell.bounds;
return cell;
}
但直到电池出列的重用的UIImageView不填充单元格。
我应该改变什么让UIImageView像第一次显示时那样出现?
谢谢洛根!这是一个快速解决方案。我的应用现在完美运行。 – trvslhlt
很高兴听到它的工作,与您的其他项目祝你好运! – Logan