ios 手势冲突解决方案

1、允许多个手势并存

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

    if(gestureRecognizer.state!=0) {

    returnYES;    }

    else{

        returnNO;

    }

    return NO;

}

2、重写冲突view

- (BOOL)gestureRecognizer:(UIGestureRecognizer*)gestureRecognizer shouldReceiveTouch:(UITouch*)touch

{

      NSLog(@"%@", NSStringFromClass([touch.view class]));

    if ([NSStringFromClass([touch.view class]) isEqualToString:@"UITableViewCellContentView"]) {

        returnNO;

    }

    return  YES;

}

你可能感兴趣的:(ios 手势冲突解决方案)