Skip to content

Commit

Permalink
Added delegate method to be able to control the gesture recognizers b…
Browse files Browse the repository at this point in the history
…eing able to play nice with other gesture recognizers.
  • Loading branch information
frankfle committed Jun 10, 2014
1 parent abec1ed commit cb4ae38
Show file tree
Hide file tree
Showing 2 changed files with 21 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
15 changes: 15 additions & 0 deletions SWRevealViewController/SWRevealViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1075,6 +1075,21 @@ - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)recognizer
return NO;
}

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

return NO;
}

- (BOOL)_tapGestureShouldBegin
{
Expand Down

0 comments on commit cb4ae38

Please sign in to comment.