[ios] fixes #5406 view for annotation (#5413)

This commit is contained in:
Fredrik Karlsson
2016-06-21 15:21:22 +02:00
committed by GitHub
parent a7d5717cf5
commit 3995d6ff68
2 changed files with 18 additions and 0 deletions

View File

@@ -951,6 +951,15 @@ IB_DESIGNABLE
*/
- (void)removeAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)annotations;
/**
Returns an `MGLAnnotationView` if the given annotation is currently associated
with a view, otherwise nil.
@param annotation The annotation associated with the view.
Annotation must conform to the `MGLAnnotation` protocol.
*/
- (nullable MGLAnnotationView *)viewForAnnotation:(id <MGLAnnotation>)annotation;
/**
Returns a reusable annotation image object associated with its identifier.

View File

@@ -2984,6 +2984,15 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
return annotationView;
}
- (nullable MGLAnnotationView *)viewForAnnotation:(id<MGLAnnotation>)annotation
{
MGLAnnotationTag annotationTag = [self annotationTagForAnnotation:annotation];
if (annotationTag == MGLAnnotationTagNotFound) return nil;
MGLAnnotationContext &annotationContext = _annotationContextsByAnnotationTag.at(annotationTag);
return annotationContext.annotationView;
}
- (double)alphaForShapeAnnotation:(MGLShape *)annotation
{
if (_delegateHasAlphasForShapeAnnotations)