diff options
Diffstat (limited to 'platform/ios/src/MGLMapView.mm')
-rw-r--r-- | platform/ios/src/MGLMapView.mm | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 232beb9b2e..49218747ae 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -213,6 +213,7 @@ public: @property (nonatomic) NSMutableArray<NSLayoutConstraint *> *logoViewConstraints; @property (nonatomic, readwrite) UIButton *attributionButton; @property (nonatomic) NSMutableArray<NSLayoutConstraint *> *attributionButtonConstraints; +@property (nonatomic, weak) UIAlertController *attributionController; @property (nonatomic, readwrite) MGLStyle *style; @@ -1016,6 +1017,8 @@ public: } [self updateUserLocationAnnotationView]; + + [self updateAttributionAlertView]; } /// Updates `contentInset` to reflect the current window geometry. @@ -2417,6 +2420,7 @@ public: UIViewController *viewController = [self.window.rootViewController mgl_topMostViewController]; [viewController presentViewController:attributionController animated:YES completion:NULL]; + self.attributionController = attributionController; } - (void)presentTelemetryAlertController @@ -6405,6 +6409,23 @@ public: } } +- (void)updateAttributionAlertView { + if (self.attributionController.presentingViewController) { + self.attributionController.popoverPresentationController.sourceRect = self.attributionButton.frame; + switch (self.attributionButtonPosition) { + case MGLOrnamentPositionTopLeft: + case MGLOrnamentPositionTopRight: + [self.attributionController.popoverPresentationController setPermittedArrowDirections:UIMenuControllerArrowUp]; + break; + case MGLOrnamentPositionBottomLeft: + case MGLOrnamentPositionBottomRight: + [self.attributionController.popoverPresentationController setPermittedArrowDirections:UIMenuControllerArrowDown]; + break; + } + [self.attributionController.popoverPresentationController.containerView setNeedsLayout]; + } +} + - (void)enqueueAnnotationViewForAnnotationContext:(MGLAnnotationContext &)annotationContext { MGLAnnotationView *annotationView = annotationContext.annotationView; |