无需 UIEvent 即可获取所有触摸

发布于 2024-08-18 05:47:23 字数 168 浏览 4 评论 0原文

我正在寻找一种方法来获取所有当前的触摸,即使没有发生任何事件。我知道 [UIEvent allTouches] 但我需要能够看到“这些是屏幕上的所有触摸”,即使它们都没有改变。看起来应该是可能的,因为 allTouches 可以访问尚未更新的触摸,因此手机正在跟踪它们。

I'm looking for a way to get all the current touches even if no event has occurred. I know about [UIEvent allTouches] but I need to be able to see "these are all the touches on the screen" even if none of them has changed. It seems like it should be possible because allTouches can access touches which haven't been updated, so the phone is tracking them.

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

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

发布评论

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

评论(2

计㈡愣 2024-08-25 05:47:23

覆盖touchesBegan和touchesEnded,并将当前点与事件中的缓存点进行比较。

Override touchesBegan and touchesEnded, and compare the current point against the cached point from the event.

黒涩兲箜 2024-08-25 05:47:23

尝试 hitTest:withEvent 并使用 pointInside:withEvent 进行过滤。

Try hitTest:withEvent and filter with pointInside:withEvent.

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