【发布时间】:2014-04-25 03:23:22
【问题描述】:
当我用这段代码点击单元格时,我设法设置了单元格背景颜色:
- (void) collectionView:(UICollectionView *)collectionView didHighlightItemAtIndexPath: (NSIndexPath *)indexPath
{
NSLog(@"highlighted cell at index path %ld", (long)indexPath.row);
UICollectionViewCell* cell = [collectionView cellForItemAtIndexPath:indexPath];
cell.contentView.backgroundColor = [UIColor blueColor];
}
但是我有两个问题
1:我在一个视图中显示 6 个单元格,然后我滑动显示其他单元格,其中一些单元格也以蓝色背景突出显示
2:我选择单元格A并将背景颜色更改为蓝色后,当我选择B时,A中的背景颜色并没有变回白色,我怎么能把它改回来?
谢谢!
【问题讨论】:
标签: ios uicollectionview