UITapGestureRecognizer 和 UICollectionView、UITableView的点击事件冲突问题

解决:https://blog.gocy.tech/2016/11/19/iOS-touch-handling/

1. tap.delegate = self; tap加个代理<UIGestureRecognizerDelegate>

2.

//UITapGestureRecognizer 和 UICollectionView  冲突
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
    if ([touch.view isDescendantOfView:self.collectionView]) {
    
        return NO;
    }
    
    return YES;
}

猜你喜欢

转载自www.cnblogs.com/miaomiaocat/p/10304229.html