UITapGestureRecognizer 具有多次触摸问题?

发布于 2024-11-05 03:26:40 字数 239 浏览 3 评论 0原文

我想知道是否有其他人在设置具有多次触摸(而不是多次点击)的 UITapGestureRecognizer 时遇到问题。如果我将触摸次数设置为 1,一切都会很好。如果我将触摸次数设置为 2,则大约 80% 的时间会触发识别器。如果我将触摸次数设置为 3,那么大约 10% 的时间会触发它。我将识别器附加到 UIWebView。我什至尝试过使用delaysTouchesBegan/End 来看看是否有帮助。有人对如何使 2 次和 3 次触摸更可靠地工作有任何建议吗?

I'm wondering if anybody else has had problems with setting up a UITapGestureRecognizer with multiple touches (NOT multiple taps). If I set the number of touches to 1 everything works pretty well. If I set the number of touches to 2 the recognizer is triggered about 80% of the time. If I set the number of touches to 3 then it's triggered about 10% of the time. I'm attaching the recognizer to a UIWebView. I've even tried messing around with delaysTouchesBegan/End to see if that helps things. Anyone have any suggestions on how to make 2 and 3 touches work more reliably?

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

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

发布评论

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

评论(1

〆凄凉。 2024-11-12 03:26:40

复制自上面的评论:

我已经弄清楚了。当我添加以下委托方法时:

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

一切都开始顺利进行。 – rforte 2天前

Copied from the comment above:

I've figured it out. When I add the following delegate method:

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

Everything starts working like a champ. – rforte 2 days ago

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