touchesMoved():它是唯一的手指跟踪 API 吗?准确吗?
我正在编写一个 iPad 应用程序,需要非常精确地计算手指运动的时间,因此我渴望获得最佳的性能和准确性。我对此有两个问题:
为了拦截屏幕上的手指位置,我必须使用touchesMoved(),还是有较低级别的API?
有谁知道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:
For intercepting finger position on screen, must I use touchesMoved(), or is there a lower-level API?
Does anyone know whether touchesMoved() returns the exact position on screen, or does the iPad perform some interpolation?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您有 3 种方法来拦截手指位置:
a) UIResponder Delegate 方法:
b) UIGestureRecognizer 的方法
c) 您还可以在 UIApplicationDelegate 或 UIWindow 中重写 - (void)sendEvent:(UIEvent *)event; 来捕获 UIEvents - 但不建议使用此方法。
所有这些方法都适用于包含触摸点的 UITouch。该点由设备硬件计算得出,因此不会影响精度。
最后:推荐的最小触摸区域为 44x44。如果您的触摸区域较小,那么用户在使用您的软件时会感到不舒服。
You have 3 ways to intercept finger positions:
a) UIResponder Delegate metods:
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.
触摸不是很精确,因为手指不是很精确(远不如鼠标光标),并且因为跟踪硬件不是很精确(因为它不需要,因为手指大小 - 如果没有明显的触摸区域,它不起作用)。
话虽这么说,与许多其他电容式触摸设备相比,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.