Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UICollectionView cell change background while tap

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:?

like image 212
user2424271 Avatar asked Jun 20 '13 09:06

user2424271


1 Answers

But the result is that I can see the change only when i keep my finger for a bit longer time

The delay your are experiencing is probably related to the "Delay content touches" checkbox in the storyboard.

the checkbox in storyboard

Try to un-check it.

like image 175
Guillaume Algis Avatar answered Oct 18 '22 21:10

Guillaume Algis