touchesMoved():它是唯一的手指跟踪 API 吗?准确吗?

发布于 2024-11-17 02:27:14 字数 219 浏览 3 评论 0原文

我正在编写一个 iPad 应用程序,需要非常精确地计算手指运动的时间,因此我渴望获得最佳的性能和准确性。我对此有两个问题:

  1. 为了拦截屏幕上的手指位置,我必须使用touchesMoved(),还是有较低级别的API?

  2. 有谁知道touchesMoved()是否返回屏幕上的确切位置,或者iPad是否执行一些插值?

谢谢!

I'm writing an iPad application that needs to time the finger movement very precisely, so I am keen on getting the best performance and accuracy I can. I have two questions about this:

  1. For intercepting finger position on screen, must I use touchesMoved(), or is there a lower-level API?

  2. Does anyone know whether touchesMoved() returns the exact position on screen, or does the iPad perform some interpolation?

Thanks!

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

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

发布评论

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

评论(2

平定天下 2024-11-24 02:27:14

您有 3 种方法来拦截手指位置:
a) UIResponder Delegate 方法:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;

b) UIGestureRecognizer 的方法

c) 您还可以在 UIApplicationDelegate 或 UIWindow 中重写 - (void)sendEvent:(UIEvent *)event; 来捕获 UIEvents - 但不建议使用此方法。

所有这些方法都适用于包含触摸点的 UITouch。该点由设备硬件计算得出,因此不会影响精度。

最后:推荐的最小触摸区域为 44x44。如果您的触摸区域较小,那么用户在使用您的软件时会感到不舒服。

You have 3 ways to intercept finger positions:
a) UIResponder Delegate metods:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;

b) UIGestureRecognizer's methods

c) You also can override - (void)sendEvent:(UIEvent *)event; within UIApplicationDelegate or UIWindow to catch UIEvents - but this method is not recommended.

All this methods work with UITouch that contain touch point. This point calculated by device hardware, so you can't affect precision.

And the last: minimal recommended touch area is 44x44. If you touch area will be smaller then users will fill yourself discomfortable working with your software.

永言不败 2024-11-24 02:27:14

触摸不是很精确,因为手指不是很精确(远不如鼠标光标),并且因为跟踪硬件不是很精确(因为它不需要,因为手指大小 - 如果没有明显的触摸区域,它不起作用)。

话虽这么说,与许多其他电容式触摸设备相比,iDevice 具有非常好的触摸屏。我只是不确定实际中是否可以达到像素精度。

不过,尝试这个很容易。

Touches are not very precise, because fingers are not very precise (much less so than a mouse cursor), and because the tracking hardware isn't very precise (because it doesn't need to, because of finger size - it does not work without significant touched area).

That being said, the iDevices have very good touchscreens compared to many other capacitive touch devices. I'm just not sure pixel-precision is attainable in practice.

It's easy to experiment with this, though.

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