LongPressGestureRecognizer不与TapGestureRecognizer一起使用

时间:2014-12-26 22:36:33

标签: ios swift

我有UITapGestureRecognizerUILongPressGestureREcognizer。 在视图中我有加载:

oneTapRecognizer.delegate = self
longPressRecognizer.delegate = self
oneTapRecognizer.requireGestureRecognizerToFail(longPressRecognizer)

然后我也有功能:

func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWithGestureRecognizer otherGestureRecognizer: UIGestureRecognizer) -> Bool {
       return true
    }

我确实看到上面的功能在我点击时多次到达。 然后我试着用长按:

@IBAction func longPress(sender: UILongPressGestureRecognizer) {
    println("long pressed")
}

但长按不起作用。 Tap工作正常。

0 个答案:

没有答案