From 8dff7ab2f0fe1f2d1412e79c99285f1a389e6541 Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Thu, 25 Aug 2016 17:43:42 -0400 Subject: [PATCH] [ios] Improve user location annotation documentation - Add note to mapView:viewForAnnotation: delegate method. - Edit docs in iosapp's implementation of that delegate method. --- platform/ios/app/MBXViewController.m | 16 +++++++++------- platform/ios/src/MGLMapViewDelegate.h | 5 +++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index bd8230ea1..605d6b2da 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -732,15 +732,17 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie annotationView = [[MBXAnnotationView alloc] initWithReuseIdentifier:MBXViewControllerAnnotationViewReuseIdentifer]; annotationView.frame = CGRectMake(0, 0, 10, 10); annotationView.backgroundColor = [UIColor whiteColor]; - - // uncomment to make the annotation view draggable - // also note that having two long press gesture recognizers on overlapping views (`self.view` & `annotationView`) will cause weird behaviour - // comment out the pin dropping functionality in the handleLongPress: method in this class to make draggable annotation views play nice + + // Note that having two long press gesture recognizers on overlapping + // views (`self.view` & `annotationView`) will cause weird behaviour. + // Comment out the pin dropping functionality in the handleLongPress: + // method in this class to make draggable annotation views play nice. annotationView.draggable = YES; - // uncomment to force annotation view to maintain a constant size when the map is tilted - // by default, annotation views will shrink and grow as the move towards and away from the - // horizon. Relatedly, annotations backed by GL sprites ONLY scale with viewing distance currently. + // Uncomment to force annotation view to maintain a constant size when + // the map is tilted. By default, annotation views will shrink and grow + // as they move towards and away from the horizon. Relatedly, annotations + // backed by GL sprites currently ONLY scale with viewing distance. // annotationView.scalesWithViewingDistance = NO; } else { // orange indicates that the annotation view was reused diff --git a/platform/ios/src/MGLMapViewDelegate.h b/platform/ios/src/MGLMapViewDelegate.h index 3ec7d0d58..ea9933f87 100644 --- a/platform/ios/src/MGLMapViewDelegate.h +++ b/platform/ios/src/MGLMapViewDelegate.h @@ -273,6 +273,11 @@ NS_ASSUME_NONNULL_BEGIN Touch frameworks. On the other hand, static annotation images use less memory and draw more quickly than annotation views. + The user location annotation view can also be customized via this method. When + `annotation` is an instance of `MGLUserLocation` (or equal to the map view’s + `userLocation` property), return an instance of `MGLUserLocationAnnotationView` + (or a subclass thereof). + @param mapView The map view that requested the annotation view. @param annotation The object representing the annotation that is about to be displayed.