[ios] Improve user location annotation documentation

- Add note to mapView:viewForAnnotation: delegate method.
- Edit docs in iosapp's implementation of that delegate method.
This commit is contained in:
Jason Wray
2016-08-25 17:43:42 -04:00
parent 018f395442
commit 8dff7ab2f0
2 changed files with 14 additions and 7 deletions

View File

@@ -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

View File

@@ -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.