You're going to want to set one of the two UIGestureRecognizer
's delegates to an object that makes sense (likely self
) then listen, and return YES
for this method:
- (BOOL) gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer
shouldRecognizeSimultaneouslyWithGestureRecognizer:
(UIGestureRecognizer *)otherGestureRecognizer {
return YES;
}
This method is called when recognition of a gesture by either gestureRecognizer
or otherGestureRecognizer
would block the other gesture recognizer from recognizing its gesture. Note that returning YES
is guaranteed to allow simultaneous recognition; returning NO
, on the other hand, is not guaranteed to prevent simultaneous recognition because the other gesture recognizer's delegate may return YES
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…