难以在 iOS 应用程序中激活 3 触摸手势识别器

发布于 2024-10-29 19:29:58 字数 339 浏览 1 评论 0原文

我有一个应用程序经常使用手势识别器。从我所做的研究中,我发现有识别手势的touchesBegan方法,然后还有手势识别器,应该更流畅。

我遇到的问题是,手势识别器的响应速度或准确性不如 TouchBegan 方法,但更容易实现,这显然就是我使用它们的原因。如果我想用手势识别器检测到 3 个手指手势,这是相当困难的,因为我必须同时按下我的 3 个手指,否则它不会触发。这与touchesBegan 方法相反,touchesBegan 方法只知道在任何时候有多少根手指按下。

我在实现这个看似不错的手势功能时是否遗漏了一些东西,导致它的响应速度不太快?我已将最大和最小接触次数设置为 3,这不正确吗?

请帮忙。谢谢!!

I have an app that uses gesture recognizers quite a bit. From the studying I have done, I have found that there is the touchesBegan method of recognizing a gesture, and then there are gesture recognizers, which should be more slick.

The problem I am running into is that the gesture recognizers aren't nearly as responsive or accurate as the touchesBegan method, but are a lot easier to implement, which is obviously why I am using them. If I want to have a 3 finger gesture detected with a gesture recognizer, it is quite difficult because I have to press down my 3 fingers at the EXACT same time, or else it won't fire. This is in contrast to the touchesBegan method that just knows how many fingers you have down at any point.

Am I missing something with the implementation of this seemingly nice gesture feature that is making it not very responsive? I have set the max and min touches to 3, is that incorrect?

Please help. Thanks!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

她比我温柔 2024-11-05 19:29:58

您需要同时按下的原因是,默认情况下,一次只能识别一个手势识别器。因此,一旦您按下一根手指,识别器就会自动阻止另外两根手指。

尝试实现 UIGestureRecognizerDelegate 并使用:

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
    return YES;
}

我不确定这是否会解决问题,但可能会。

干杯。

The reason you need to press at the exact same time is because, by default, only one gesture recognizer can be recognized at a time. So once you press one finger down that recognizer automatically blocks the other two.

Try implementing the UIGestureRecognizerDelegate and using:

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
    return YES;
}

I'm not sure if this will solve the issue or not but it might.

Cheers.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文