gpt4 book ai didi

iOS 使用多个滑动识别器

转载 作者:行者123 更新时间:2023-11-29 04:07:06 24 4
gpt4 key购买 nike

我的 View 上有左右滑动识别器以及表格。当用户在表格 View 上向左->向右滑动时,表格处理它们并滑动表格内容而不是执行向左->,就会出现问题右滑动识别器方法。如何提高左->右滑动识别器的灵敏度?

这是识别器的代码:

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];

最佳答案

您可以要求一个gestureRecognizer在调用另一个gestureRecognizer之前失败。

[lowerPriorityGestureRecognizer requireGestureRecognizerToFail:higherPriorityGestureRecognizer];

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

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com