Skip to content

Commit

Permalink
Merge pull request #264 from frankfle/master
Browse files Browse the repository at this point in the history
Adding new delegate method for gesture/touch clobbering.
  • Loading branch information
John Lluch Zorrilla committed Jun 11, 2014
2 parents abec1ed + 11e1ec5 commit 357d054
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
6 changes: 6 additions & 0 deletions SWRevealViewController/SWRevealViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,12 @@ typedef enum
// Implement this to return NO when you want the tap gesture recognizer to be ignored
- (BOOL)revealControllerTapGestureShouldBegin:(SWRevealViewController *)revealController;

// Implement this to return YES if you want this gesture recognizer to share touch events with the pan gesture
- (BOOL)revealControllerPanGestureRecognizerShouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer;

// Implement this to return YES if you want this gesture recognizer to share touch events with the tap gesture
- (BOOL)revealControllerTapGestureRecognizerShouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer;

// Called when the gestureRecognizer began and ended
- (void)revealControllerPanGestureBegan:(SWRevealViewController *)revealController;
- (void)revealControllerPanGestureEnded:(SWRevealViewController *)revealController;
Expand Down
17 changes: 17 additions & 0 deletions SWRevealViewController/SWRevealViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1075,6 +1075,23 @@ - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)recognizer
return NO;
}

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
if ( gestureRecognizer == _panGestureRecognizer )
{
if ( [_delegate respondsToSelector:@selector(revealControllerPanGestureRecognizerShouldRecognizeSimultaneouslyWithGestureRecognizer:)] )
if ( [_delegate revealControllerPanGestureRecognizerShouldRecognizeSimultaneouslyWithGestureRecognizer:otherGestureRecognizer] == YES )
return YES;
}
if ( gestureRecognizer == _tapGestureRecognizer )
{
if ( [_delegate respondsToSelector:@selector(revealControllerTapGestureRecognizerShouldRecognizeSimultaneouslyWithGestureRecognizer:)] )
if ( [_delegate revealControllerTapGestureRecognizerShouldRecognizeSimultaneouslyWithGestureRecognizer:otherGestureRecognizer] == YES )
return YES;
}

return NO;
}

- (BOOL)_tapGestureShouldBegin
{
Expand Down

0 comments on commit 357d054

Please sign in to comment.