我有UITapGestureRecognizer
和UILongPressGestureREcognizer
。
在视图中我有加载:
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工作正常。