【发布时间】:2014-04-27 22:32:37
【问题描述】:
我正在尝试使用自定义 UICollectionViewCells 实现侧滚动 UICollectionView。每个自定义单元格都包含一个应该填充单元格的 UIImageView。现在我正在像这样设置 UIImageView 的大小,
-(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 在单元格首次显示时显示为应有的样子?
【问题讨论】:
标签: ios uicollectionview uicollectionviewcell