UICollectionView delegate's tap method not getting called

后端 未结 8 1575
梦毁少年i
梦毁少年i 2021-01-03 20:50

I have a collection view, the datasource delegate works well, but UICollectionViewDelegate:

-(void)collectionView:(UICollectionView *)collection         


        
8条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-03 21:11

    It looks like there is a UITapGestureRecognizer somewhere up in the view hierarchy. By default, UITapGestureRecognizers consume the touch that they recieve, meaning that it is not passed to the views below it in the hierarchy. You need to find the rogue tap gesture and add this line

    tapGestureRecognizer.cancelsTouchesInView = NO;
    

    This will make it pass touches to views below it in the hierarchy, and hopefully solve your problem.

提交回复
热议问题