From 8f0837a6ea40d1b7f8f54a0eb186952187fcd16b Mon Sep 17 00:00:00 2001 From: Lloyd Sheng Date: Thu, 21 Mar 2019 17:31:04 +0800 Subject: [PATCH 1/3] Fix issue #12897 --- platform/ios/src/MGLMapView.mm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 232beb9b2e8..0a699057e06 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -213,6 +213,7 @@ @interface MGLMapView () *logoViewConstraints; @property (nonatomic, readwrite) UIButton *attributionButton; @property (nonatomic) NSMutableArray *attributionButtonConstraints; +@property (nonatomic, weak) UIAlertController *attributionController; @property (nonatomic, readwrite) MGLStyle *style; @@ -1016,6 +1017,8 @@ - (void)layoutSubviews } [self updateUserLocationAnnotationView]; + + [self updateAttributionAlertView]; } /// Updates `contentInset` to reflect the current window geometry. @@ -2417,6 +2420,7 @@ - (void)showAttribution:(id)sender UIViewController *viewController = [self.window.rootViewController mgl_topMostViewController]; [viewController presentViewController:attributionController animated:YES completion:NULL]; + self.attributionController = attributionController; } - (void)presentTelemetryAlertController @@ -6405,6 +6409,12 @@ - (void)updateCalloutView } } +- (void)updateAttributionAlertView { + if (self.attributionController && self.attributionController.presentingViewController) { + self.attributionController.popoverPresentationController.sourceRect = self.attributionButton.frame; + } +} + - (void)enqueueAnnotationViewForAnnotationContext:(MGLAnnotationContext &)annotationContext { MGLAnnotationView *annotationView = annotationContext.annotationView; From 1992e031b9858a4c5a073b8961126b869d6f11f8 Mon Sep 17 00:00:00 2001 From: Lloyd Sheng Date: Fri, 22 Mar 2019 17:52:53 +0800 Subject: [PATCH 2/3] Fix arrow direction issue --- platform/ios/src/MGLMapView.mm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 0a699057e06..49218747aeb 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -6410,8 +6410,19 @@ - (void)updateCalloutView } - (void)updateAttributionAlertView { - if (self.attributionController && self.attributionController.presentingViewController) { + 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]; } } From ac15f1a7bbdb77840d6f3b957b80fab8c457f5f7 Mon Sep 17 00:00:00 2001 From: Lloyd Sheng Date: Thu, 11 Apr 2019 15:57:31 +0800 Subject: [PATCH 3/3] Update change log --- platform/ios/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 1f6e8b01c38..72e3e75cb26 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -5,6 +5,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT ## 4.11.0 * Fixed an Interface Builder crash when using an `MGLMapView` in a storyboard. ([#14379](https://github.com/mapbox/mapbox-gl-native/pull/14379)) +* Fix a bug that wrong position of attribution dialog after rotation. ([#14185](https://github.com/mapbox/mapbox-gl-native/pull/14185)) ## 4.10.0