Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Adds tapOnLabelForMarker:onMap:onLayer: method to RMMapViewDelegate protocol. #161

Merged
merged 1 commit into from

2 participants

@dguerri

Adds tapOnLabelForMarker:onMap:onLayer: method to RMMapViewDelegate protocol.

This method allows the implementation of tappable buttons in markers label.

For instance, you can add a button layer with name @"NameOfYourButtonLayerHere" to a marker label and implement the method tapOnLabelForMarker:onMap:onLayer: for your RMMapViewDelegate as follows:

  • (void) tapOnLabelForMarker:(RMMarker)marker onMap:(RMMapView)map onLayer:(CALayer *)layer { if (layer.name == @"NameOfYourButtonLayerHere") { //Code to serve button tap here } }

See also http://stackoverflow.com/questions/5967909/route-me-marker-label-with-uibuttontypedetaildisclosure-button-button-isnt-cl

@dguerri dguerri Adds tapOnLabelForMarker:onMap:onLayer: method to RMMapViewDelegate p…
…rotocol.

This method allows the implementation of tappable buttons in markers label.

For instance, you can add a button layer with name @"NameOfYourButtonLayerHere" to a marker label and implement the method tapOnLabelForMarker:onMap:onLayer: for your RMMapViewDelegate as follows:

- (void) tapOnLabelForMarker:(RMMarker*)marker
                       onMap:(RMMapView*)map
                       onLayer:(CALayer *)layer
{
    if (layer.name == @"NameOfYourButtonLayerHere") {
		//Code to serve button tap here
    }
}

See also http://stackoverflow.com/questions/5967909/route-me-marker-label-with-uibuttontypedetaildisclosure-button-button-isnt-cl
8dc7517
@dguerri

I forgot code formatting...

- (void) tapOnLabelForMarker:(RMMarker*)marker
                       onMap:(RMMapView*)map
                       onLayer:(CALayer *)layer
{
    if (layer.name == @"NameOfYourButtonLayerHere") {
            //Code to serve button tap here
    }
}
@michaeltyson michaeltyson merged commit e42ae37 into from
@jklimke jklimke referenced this pull request from a commit in jklimke/mapbox-ios-sdk
@incanus incanus fixes #161: cross-link existing file cache info 2fed4a2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 27, 2012
  1. @dguerri

    Adds tapOnLabelForMarker:onMap:onLayer: method to RMMapViewDelegate p…

    dguerri authored
    …rotocol.
    
    This method allows the implementation of tappable buttons in markers label.
    
    For instance, you can add a button layer with name @"NameOfYourButtonLayerHere" to a marker label and implement the method tapOnLabelForMarker:onMap:onLayer: for your RMMapViewDelegate as follows:
    
    - (void) tapOnLabelForMarker:(RMMarker*)marker
                           onMap:(RMMapView*)map
                           onLayer:(CALayer *)layer
    {
        if (layer.name == @"NameOfYourButtonLayerHere") {
    		//Code to serve button tap here
        }
    }
    
    See also http://stackoverflow.com/questions/5967909/route-me-marker-label-with-uibuttontypedetaildisclosure-button-button-isnt-cl
This page is out of date. Refresh to see the latest.
View
1  MapView/Map/RMMapView.h
@@ -139,6 +139,7 @@ typedef struct {
BOOL _delegateHasSingleTapOnMap;
BOOL _delegateHasTapOnMarker;
BOOL _delegateHasTapOnLabelForMarker;
+ BOOL _delegateHasTapOnLabelForMarkerOnLayer;
BOOL _delegateHasAfterMapTouch;
BOOL _delegateHasShouldDragMarker;
BOOL _delegateHasDidDragMarker;
View
7 MapView/Map/RMMapView.m
@@ -193,6 +193,7 @@ - (void) setDelegate: (id<RMMapViewDelegate>) _delegate
_delegateHasTapOnMarker = [(NSObject*) delegate respondsToSelector:@selector(tapOnMarker:onMap:)];
_delegateHasTapOnLabelForMarker = [(NSObject*) delegate respondsToSelector:@selector(tapOnLabelForMarker:onMap:)];
+ _delegateHasTapOnLabelForMarkerOnLayer = [(NSObject*) delegate respondsToSelector:@selector(tapOnLabelForMarker:onMap:onLayer:)];
_delegateHasAfterMapTouch = [(NSObject*) delegate respondsToSelector: @selector(afterMapTouch:)];
@@ -586,10 +587,16 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
if (_delegateHasTapOnLabelForMarker) {
[delegate tapOnLabelForMarker:(RMMarker*)superlayer onMap:self];
}
+ if (_delegateHasTapOnLabelForMarkerOnLayer) {
+ [delegate tapOnLabelForMarker:(RMMarker*)superlayer onMap:self onLayer:hit];
+ }
} else if ([superlayer superlayer] != nil && [[superlayer superlayer] isKindOfClass: [RMMarker class]]) {
if (_delegateHasTapOnLabelForMarker) {
[delegate tapOnLabelForMarker:(RMMarker*)[superlayer superlayer] onMap:self];
}
+ if (_delegateHasTapOnLabelForMarkerOnLayer) {
+ [delegate tapOnLabelForMarker:(RMMarker*)[superlayer superlayer] onMap:self onLayer:hit];
+ }
} else if (_delegateHasSingleTapOnMap) {
[delegate singleTapOnMap: self At: [touch locationInView:self]];
}
View
1  MapView/Map/RMMapViewDelegate.h
@@ -57,6 +57,7 @@
- (void) tapOnMarker: (RMMarker*) marker onMap: (RMMapView*) map;
- (void) tapOnLabelForMarker: (RMMarker*) marker onMap: (RMMapView*) map;
+- (void) tapOnLabelForMarker: (RMMarker*) marker onMap: (RMMapView*) map onLayer:(CALayer *)layer;
- (BOOL) mapView:(RMMapView *)map shouldDragMarker:(RMMarker *)marker withEvent:(UIEvent *)event;
- (void) mapView:(RMMapView *)map didDragMarker:(RMMarker *)marker withEvent:(UIEvent *)event;
Something went wrong with that request. Please try again.