summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorMaciej Swic <maciej@swic.name>2015-09-08 12:11:55 +0200
committerJustin R. Miller <incanus@codesorcery.net>2015-10-12 10:54:53 -0700
commit1a5c452fe3d96be5ebdb21b3f06d8156242b9dfd (patch)
tree2441b39e293b58b519dbe4cddb24998b2ed9b3d7 /platform
parente3d9fb171543c060aea53679dc1d298a156e656a (diff)
downloadqtlocation-mapboxgl-1a5c452fe3d96be5ebdb21b3f06d8156242b9dfd.tar.gz
Forwards the SMCalloutView tap delegate
Diffstat (limited to 'platform')
-rw-r--r--platform/ios/MGLMapView.mm15
1 files changed, 13 insertions, 2 deletions
diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm
index 64f8d0f69d..85edc33dca 100644
--- a/platform/ios/MGLMapView.mm
+++ b/platform/ios/MGLMapView.mm
@@ -79,7 +79,7 @@ mbgl::util::UnitBezier MGLUnitBezierForMediaTimingFunction(CAMediaTimingFunction
#pragma mark - Private -
-@interface MGLMapView () <UIGestureRecognizerDelegate, GLKViewDelegate, CLLocationManagerDelegate, UIActionSheetDelegate>
+@interface MGLMapView () <UIGestureRecognizerDelegate, GLKViewDelegate, CLLocationManagerDelegate, UIActionSheetDelegate, SMCalloutViewDelegate>
@property (nonatomic) EAGLContext *context;
@property (nonatomic) GLKView *glView;
@@ -1451,6 +1451,14 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration)
}
}
+- (void)calloutViewClicked:(SMCalloutView *__attribute__ ((unused)))calloutView
+{
+ if ([self.delegate respondsToSelector:@selector(mapView:tapOnLabelForAnnotation:)])
+ {
+ [self.delegate mapView:self tapOnLabelForAnnotation:self.selectedAnnotation];
+ }
+}
+
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
NSArray *validSimultaneousGestures = @[ self.pan, self.pinch, self.rotate ];
@@ -2445,7 +2453,10 @@ CLLocationCoordinate2D MGLLocationCoordinate2DFromLatLng(mbgl::LatLng latLng)
[self.selectedAnnotationCalloutView.rightAccessoryView addGestureRecognizer:calloutAccessoryTap];
}
}
-
+
+ // set annotation delegate to handle taps on the callout view
+ self.selectedAnnotationCalloutView.delegate = self;
+
// present popup
[self.selectedAnnotationCalloutView presentCalloutFromRect:calloutBounds
inView:self.glView