我在视图和表上都具有左右滑动识别器,当用户在表视图上从左向右滑动时,表会处理它们并滑动表内容而不是执行左向右滑动识别器,这是一个问题方法。如何提高左右滑动识别器的灵敏度?

这是识别器的代码:

UISwipeGestureRecognizer *swipeRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeRight)];

swipeRecognizer.numberOfTouchesRequired = 1;

swipeRecognizer.direction = UISwipeGestureRecognizerDirectionRight;

[self.view addGestureRecognizer:swipeRecognizer];

UISwipeGestureRecognizer *swipeRecognizer1 = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeLeft)];

swipeRecognizer1.direction = UISwipeGestureRecognizerDirectionLeft;

swipeRecognizer1.numberOfTouchesRequired = 1;

[self.view addGestureRecognizer:swipeRecognizer1];

最佳答案

您可以要求一个手势重新识别器失败,然后再调用另一个。

[lowerPriorityGestureRecognizer requireGestureRecognizerToFail:higherPriorityGestureRecognizer];

关于ios - iOS与多个滑动识别器一起使用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15026521/

10-11 08:18