Reputation: 494
I created two custom gesture recognizer.
PinGestureRecognizer
. this gesture is using for drag the view in horizontal direction.TagGestureRecognizer
. this gesture is using for increase the height of the view till user drag the view in vertically.Now, i want to fail one gesture if another gesture got recognized.
Example:
PinGestureRecognizer
and fail TapGestureRecognizer
and vice versa. How can i achieve the functionality.
I know iOS7 provide the methods like
shouldBeRequiredToFailByGestureRecognizer:
shouldRequireFailureOfGestureRecognizer:
If its equal to my problem or not i was not able to understand. if its correct means kindly suggest me to get same functionality in iOS4 and above.
Thanks in advance....
Upvotes: 0
Views: 101
Reputation: 6524
Use the gestureRecognizerShouldBegin
delegate method for the PinGestureRecognizer
, for example:
// To handle not scrolling vertically
- (BOOL)gestureRecognizerShouldBegin:(UIPanGestureRecognizer *)panGestureRecognizer {
CGPoint translation = [panGestureRecognizer translationInView:myView];
return fabs(translation.y) < fabs(translation.x);
}
Upvotes: 2