[英]How to detect unintentional touches when lifting a finger?
When i drag my finger, my app shows the finger's exact coordinates. 当我拖动手指时,我的应用程序会显示手指的确切坐标。
When i lift the finger the coordinates change a bit. 当我抬起手指时,坐标会改变一点。 They shouldn't.
他们不应该。
This only happens when the finger is a thumb and it does happen because when i lift it, the iPad senses one or two more touches (calls touchesMoved) before touchesEnded
gets called. 这仅在手指为拇指时才会发生,并且确实发生是因为当我抬起手指时,在
touchesEnded
被调用之前,iPad会感觉到一两个以上的触摸(称为touchesMoved)。
I tried to detect this by checking big pathMajorRadius
changes but it's not effective because these changes can also occur when doing regular dragging movements. 我尝试通过检查
pathMajorRadius
大变化来检测到这一点,但是它无效,因为在进行常规拖动运动时也会发生这些变化。
So, i ask, how to reliably detect unintentional touches when lifting a finger off the iPad? 因此,我问,从iPad上抬起手指时,如何可靠地检测到意外触摸?
If you need more data, please ask. 如果您需要更多数据,请询问。
To check number of touches on screen, you can do the following. 要检查屏幕上的触摸次数,您可以执行以下操作。 In the touchesBegan, touchesMoved, and touchesEnded methods, one parameter is event, which is a UIEvent object.
在touchesBegan,touchesMoved和touchesEnded方法中,一个参数是event,它是一个UIEvent对象。 The number of fingers on the screen is [[event allTouches]count].
屏幕上的手指数为[[event allTouches] count]。 So if number of touches greater than one, you can edit code so that it wont be taken into consideration.
因此,如果触摸次数大于1,则可以编辑代码,这样就不会考虑它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.