Skip to content

Commit

Permalink
fixes Outdooractive#121: merge in gesture fix from @ryanmaxwell
Browse files Browse the repository at this point in the history
  • Loading branch information
incanus committed Nov 2, 2012
1 parent be69e00 commit f0bdee9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions MapView/Map/RMMapView.m
Original file line number Diff line number Diff line change
Expand Up @@ -1188,12 +1188,15 @@ - (void)createMapView
UITapGestureRecognizer *doubleTapRecognizer = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)] autorelease];
doubleTapRecognizer.numberOfTouchesRequired = 1;
doubleTapRecognizer.numberOfTapsRequired = 2;
doubleTapRecognizer.delegate = self;

UITapGestureRecognizer *singleTapRecognizer = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)] autorelease];
singleTapRecognizer.numberOfTouchesRequired = 1;
[singleTapRecognizer requireGestureRecognizerToFail:doubleTapRecognizer];
singleTapRecognizer.delegate = self;

UILongPressGestureRecognizer *longPressRecognizer = [[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)] autorelease];
longPressRecognizer.delegate = self;

[self addGestureRecognizer:singleTapRecognizer];
[self addGestureRecognizer:doubleTapRecognizer];
Expand All @@ -1202,6 +1205,7 @@ - (void)createMapView
// two finger taps
UITapGestureRecognizer *twoFingerSingleTapRecognizer = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTwoFingerSingleTap:)] autorelease];
twoFingerSingleTapRecognizer.numberOfTouchesRequired = 2;
twoFingerSingleTapRecognizer.delegate = self;

[self addGestureRecognizer:twoFingerSingleTapRecognizer];

Expand Down Expand Up @@ -1596,6 +1600,14 @@ - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)recognizer
return YES;
}

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
if ([touch.view isKindOfClass:[UIControl class]])
return NO;

return YES;
}

- (void)handlePanGesture:(UIPanGestureRecognizer *)recognizer
{
if (recognizer.state == UIGestureRecognizerStateBegan)
Expand Down

0 comments on commit f0bdee9

Please sign in to comment.