2012-03-25 48 views
0

我有一個UILongPressGestureRecognizer與minimumPressDuration爲0.5。我需要它來快速拖動。現在我也想要檢測用戶何時長時間按下而不用移動手指超過幾秒鐘。怎麼做?如何結合短拖動和長按

回答

2

看一看UIGestureRecognizerDelegate Protocol Reference

您的UIView將不得不採用該協議並實施- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer方法。如果你只有這兩個識別器,你可以簡單地返回YES

不要忘了將UIView設置爲UIGestureRecognizersdelegate

相關問題