简体   繁体   English

举手指时如何检测意外触摸?

[英]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.

相关问题 当手指滑过多个UIViews时,如何检测特定UIView中的触摸 - How do you detect touches in specific UIView when sliding finger across mutiple UIViews 检测手指触摸AppleWatch上的移动 - Detect finger touches movement on AppleWatch 如何触摸UIImageView,然后替换为另一个UIImageView,当手指移动时拖动该UIImageView,而无需抬起手指 - how to touch UIImageView, then replace with another UIImageView, which drags when finger moves, without lifting finger 当手指触摸选项卡项目时如何创建效果? - How can I create an effect when finger touches a tab item? iOS:检测touchEnded是否来自滑动屏幕或抬起手指? - iOS: Detect if touchEnded comes from sliding off screen or lifting finger? 长按后松开手指,iOS中没有Javascript事件? - No Javascript event in iOS when lifting finger after long press? 如何触发多个UIGestureRecognizers而无需从屏幕上抬起手指 - How to trigger multiple UIGestureRecognizers without lifting finger from screen 如何在iPhone上用手指触摸绘制模糊线? - how to draw a blur line with finger touches on iPhone? 如何在不将手指从屏幕抬起的情况下结束长按手势? - How to end long press gesture without lifting finger from screen? 在轻击动作期间手指触摸UILabel时,该如何突出显示? - How do I highlight a UILabel when the finger touches it during the tap motion?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM