Authored by Justin R. Miller

refs #181: added long-press annotation gesture

... ... @@ -125,6 +125,7 @@
BOOL _delegateHasLongPressOnMap;
BOOL _delegateHasTapOnAnnotation;
BOOL _delegateHasDoubleTapOnAnnotation;
BOOL _delegateHasLongPressOnAnnotation;
BOOL _delegateHasTapOnCalloutAccessoryControlForAnnotation;
BOOL _delegateHasTapOnLabelForAnnotation;
BOOL _delegateHasDoubleTapOnLabelForAnnotation;
... ... @@ -539,6 +540,7 @@
_delegateHasTapOnAnnotation = [_delegate respondsToSelector:@selector(tapOnAnnotation:onMap:)];
_delegateHasDoubleTapOnAnnotation = [_delegate respondsToSelector:@selector(doubleTapOnAnnotation:onMap:)];
_delegateHasLongPressOnAnnotation = [_delegate respondsToSelector:@selector(longPressOnAnnotation:onMap:)];
_delegateHasTapOnCalloutAccessoryControlForAnnotation = [_delegate respondsToSelector:@selector(tapOnCalloutAccessoryControl:forAnnotation:onMap:)];
_delegateHasTapOnLabelForAnnotation = [_delegate respondsToSelector:@selector(tapOnLabelForAnnotation:onMap:)];
_delegateHasDoubleTapOnLabelForAnnotation = [_delegate respondsToSelector:@selector(doubleTapOnLabelForAnnotation:onMap:)];
... ... @@ -1631,7 +1633,18 @@
if (recognizer.state != UIGestureRecognizerStateBegan)
return;
if (_delegateHasLongPressOnMap)
if ( ! _delegateHasLongPressOnMap && ! _delegateHasLongPressOnAnnotation)
return;
CALayer *hit = [_overlayView overlayHitTest:[recognizer locationInView:self]];
if (_currentAnnotation && [hit isEqual:_currentAnnotation.layer])
[self deselectAnnotation:_currentAnnotation animated:NO];
if ([hit isKindOfClass:[RMMapLayer class]] && _delegateHasLongPressOnAnnotation)
[_delegate longPressOnAnnotation:[((RMMapLayer *)hit) annotation] onMap:self];
else if (_delegateHasLongPressOnMap)
[_delegate longPressOnMap:self at:[recognizer locationInView:self]];
}
... ...
... ... @@ -128,6 +128,11 @@ typedef enum : NSUInteger {
* @param map The map view. */
- (void)doubleTapOnAnnotation:(RMAnnotation *)annotation onMap:(RMMapView *)map;
/** Tells the delegate when the user long-presses the layer for an annotation.
* @param annotation The annotation that was long-pressed.
* @param map The map view. */
- (void)longPressOnAnnotation:(RMAnnotation *)annotation onMap:(RMMapView *)map;
/** Tells the delegate when the user taps the label for an annotation.
* @param annotation The annotation whose label was was tapped.
* @param map The map view. */
... ...