I have three different gestures with two different types on one view.
First is a UITapGestureRecognizer
and the two others are UILongPressGestureRecognizer
.
The long press gesture recognizer have different minimumPressDuration
, one is 0.15
and the other is 0.50
, so to I implemented he following function so that all the gestures are recognized:
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer: (UIGestureRecognizer *) otherGestureRecognizer{
return true;
}
The function does allow all the gestures to be recognized but the problem is whenever a UILongPressGestureRecognizer
is recognized, a UITapGestureRecognizer
is also recognized.
So, I want to know how can I compare the types of gestureRecognizer in
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer: (UIGestureRecognizer *) otherGestureRecognizer
or how to stop the UITapGestureRecognizer
when UILongPressGestureRecognizer
is detected because UITapGestureRecognizer
is triggered whenever UILongPressGestureRecognizer
is triggered.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…