【发布时间】:2015-05-27 10:55:56
【问题描述】:
我目前正在开发一个显示各种单元格的 UICollectionView ...
到目前为止一切顺利,但是我对单元格的选择有问题......例如,我实现了这样的选择方法:
- (Void)collectionView:(UICollectionView *) collectionView didSelectItemAtIndexPath:(NSIndexPath *) indexPath {
UICollectionViewCell theCell * = (UICollectionViewCell *) [CollectionView cellForItemAtIndexPath: indexPath];
theCell.backgroundColor = [UIColor orangeColor];
}
问题在于,当我浏览集合视图时,除了使选定单元格成为橙色之外,还会创建其他选择..
示例:选择 7 号单元格并自动选择 14 号单元格......显然我不需要这个,但我希望它只选择 7 号单元格
我哪里做错了?我的 indexPath 有问题吗?
【问题讨论】:
标签: ios8 uicollectionview nsindexpath