UICollectionView only calling didSelectItemAtIndexPath if user double taps, will not call when user single taps

前端 未结 14 1645
名媛妹妹
名媛妹妹 2020-12-07 18:58

I have a UICollectionView which is about the size of the screen. The UICollectionViewCells that it displays are the same size as the collectionView. Each cell has a UIImage

相关标签:
14条回答
  • 2020-12-07 19:28

    In my case it was just

    self.collectionView.allowsSelection  =NO;
    

    I had in code.

    changing to

    self.collectionView.allowsSelection  =YES;
    

    fix it.

    0 讨论(0)
  • 2020-12-07 19:30

    Are you sure you're not accidentally overriding - (void)collectionView:(UICollectionView *)collectionView didDeselectItemAtIndexPath:(NSIndexPath *)indexPath? "Select" vs. "deselect" has tripped me up in the past with Xcode's code completion.

    0 讨论(0)
提交回复
热议问题