1

在我的 iOS 应用程序中,我使用UITapGesture等于numberOfTapsRequired两个。maximum duration但我需要在两次点击之间指定所需的。

如果两次点击之间的持续时间大于指定的(例如 0.5 秒),则手势不应工作。

请指导我如何实现这一目标。

提前致谢!

4

2 回答 2

2

似乎您不需要通过手势中每次点击的最大持续时间来处理点击手势。您只需要指定需要多少次触摸和点击,并且在方法中您可以检查点击手势的状态

- (void)handleTap:(UITapGestureRecognizer *)sender {     
    if (sender.state == UIGestureRecognizerStateEnded)     {         
       // handling code     
     } 
  }

上面的代码来自苹果文档。

于 2012-11-18T06:49:55.363 回答
1

This question reminds me of how the Double Tap gesture was implemented before Apple went out and implemented it themselves in UITapGestureRecognizer.

Before all of that, we used the methods, touchesBegan and touchesEnd to keep track of the number of fingers touching the screen and also, add a delay to make sure we track double taps. Thats when we could use the time which you asked. Now, there is simply no need as R.A pointed out.

于 2012-11-18T09:22:38.627 回答