Is there a possibility to change the background color of UICollectionView
only while the element is tapped. I have tried:
-(void) collectionView:(UICollectionView *)collectionView didHighlightItemAtIndexPath:(NSIndexPath *)indexPath{
//change color when tapped
}
-(void)collectionView:(UICollectionView *)collectionView didUnhighlightItemAtIndexPath:(NSIndexPath *)indexPath{
//change back on touch up
}
But the result is that I can see the change only when i keep my finger for a bit longer time.
Is there some similar stuff like in UITableViewCell
method willSelectItemAtIndexPath:
?
I think you might want keep the selected cell with different background color, right? Then try this code.
Just simply assign different BG color for cells in different status. Additionally the code below is the documentation of sequence triggering methods while someone touches a collectionView cell. You can also find these documents in UICollectionView.h file, UICollectionViewDelegate protocol part.
ios uicollectionview uicollectionviewdelegate
The delay your are experiencing is probably related to the "Delay content touches" checkbox in the storyboard.
Try to un-check it.