UIGestureRecognizer requireGestureRecognizerToFail 场景

发布于 2024-12-14 03:13:35 字数 491 浏览 3 评论 0原文

我正在为非 iOS 平台编写一个多点触控手势识别库,但 UIGestureRecognition 和所有这些概念似乎相当可靠,所以在某种程度上我使用它作为参考。

我不清楚一件事: requireGestureRecognizerToFail 方法。除了单击两次三连击之外,任何人都可以指出一些潜在的用例吗?我确实理解它的目的,甚至编写了这种实现,但最终完全删除了这个东西。因为恕我直言,代码有点味道(如果您尝试将其包含在基本手势识别类中,即使它在双击场景中完美工作)。对我来说,使用额外的几行代码来解决单双击情况(一旦您真正拥有它)似乎更干净,而不是将这个非常具体的东西包含到基本手势类中......但也许我错过了其他一些场景?你遇到过吗?


好的,所以我意外地发现了另一个用例:在 UIScrollView 上滑动(滑动平移手势识别器需要滑动才能失败)developer.apple.com/videos/wwdc/2011/?id=104 min30。

是我的问题太不清楚了,还是这里的 i 开发人员不多?

I'm writing a multitouch gesture recognition library for non-iOS platform, but UIGestureRecognition and all that concept seems pretty solid, so in some way I use it as a reference.

One thing is unclear for me: the requireGestureRecognizerToFail method. Can anyone point on some any potential use-cases other then double-triple-n-tap over single tap? I do understand it's purpose and even wrote that kind of implementation, but eventually removed this thing entirely. Because IMHO the code smells a bit (if you try to include it in base gesture recognition class, even though it works perfectly with doubletap-tap scenario). For me it seems much cleaner to have an extra couple lines of code to workaround single-doubletap situation (once you actually have it), rather then include this very specific thing into base gesture class... But maybe I miss some other scenarios? Have you met any?


OK, so I accidently found another use-case: Swipe on UIScrollView (swipe pan gesture recognizer requires swipe to fail) developer.apple.com/videos/wwdc/2011/?id=104 min30.

Was my question so unclear, or here's not many i-developers?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文