iOS基础 滑动冲突解决

1.A为父View,B为子View(假设B为CollectionView)

2.A遵循手势协议UIGestureRecognizerDelegate,在.m中实现

-(BOOL)gestureRecognizer:(UIGestureRecognizer*)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer*)otherGestureRecognizer{

    if([otherGestureRecognizer.viewisKindOfClass:[CollectionView class]]) {

        returnNO;

    }else{

        returnYES;

    }

}

意思为如果子View是CollectionView,那么滑动A的时候不能滑动B

你可能感兴趣的:(iOS基础 滑动冲突解决)