简体   繁体   English

触碰UITapGestureRecogniser

[英]Touch down on UITapGestureRecogniser

Is it possible to setup UITapGestureRecogniser for touch down event? 是否可以为触摸事件设置UITapGestureRecogniser? Default is touch up... 默认为修饰...

No, that's not possible, but it shouldn't be hard to subclass UIGestureRecognizer to create your own recognizer that does that. 不,那是不可能的,但是要UIGestureRecognizer来创建自己的识别器并不难。

You could also use a UILongPressGestureRecognizer with the minimumPressDuration property set to 0.0 . 你也可以使用一个UILongPressGestureRecognizerminimumPressDuration属性设置为0.0 Note however that your action will then be called continuously when the touch moves, so make sure to check that the state of the recognizer is UIGestureRecognizerStateBegan in the action (this will only be once). 但是请注意,触摸移动时,您的动作将被连续调用,因此请确保在动作中检查识别器的state是否为UIGestureRecognizerStateBegan (这将是一次)。

A tap gesture recogniser detects a tap. 轻击手势识别器检测到轻击。 This is different from touch up. 这不同于修饰。

The best way to detect a touch down is to write your own touchesBegan method in the custom UIView or UIViewController. 检测降落的最佳方法是在自定义UIView或UIViewController中编写自己的touchesBegan方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM