I managed to set the cell background color when it is tapped on with this code:
- (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];
}
but then I have 2 problems
1: I show 6 cells in a view, but then I slide to show the other cells, some of the cells are also highlighted with the blue background
2: After I select cell A and have the background color changed to blue, when I select B, the background color in A does not changed back to white, how could I change it back?
Thanks!