I have a collectionView with several cells, when I click one I need it to look like it has been pressed with a color or animation.
For this I use:
- (void) collectionView: (UICollectionView *) collectionView didHighlightItemAtIndexPath: (NSIndexPath *) indexPath { MiCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier: @ "myCells" forIndexPath: indexPath]; cell.vHighlight.backgroundColor = [UIColor colorWithRed: 255 / 255.0 green: 255 / 255.0 blue: 153 / 255.0 alpha: 1]; }
- (void) collectionView: (UICollectionView *) collectionView didUnhighlightItemAtIndexPath: (NSIndexPath *) indexPath { MiCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier: @ "myCells" forIndexPath: indexPath]; cell.vHighlight.backgroundColor = [UIColor clearColor]; }
When I press the cell I have verified that it goes to the corresponding method but when I change the background color of the cell it is not reflected in the view.