From 1326a21dddd9f593489202a7f98a12b8af2c5a05 Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Thu, 28 Sep 2017 16:47:54 -0400 Subject: [ios] Expose -showAttribution: publicly as an IBAction --- platform/ios/CHANGELOG.md | 1 + platform/ios/src/MGLMapView.h | 12 ++++++++++++ platform/ios/src/MGLMapView.mm | 4 ++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 93ca6d9b7b..1a8190990b 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -34,6 +34,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT * Fixed an issue that could cause line label rendering glitches when the line geometry is projected to a point behind the plane of the camera. ([#9865](https://github.com/mapbox/mapbox-gl-native/pull/9865)) * Fixed an issue that could cause a crash when using `-[MGLMapView flyToCamera:completionHandler:]` and related methods with zoom levels at or near the maximum value. ([#9381](https://github.com/mapbox/mapbox-gl-native/pull/9381)) +* Added `-[MGLMapView showAttribution:]` to allow custom attribution buttons to show the default attribution interface. ([#10085](https://github.com/mapbox/mapbox-gl-native/pull/10085)) ## 3.6.4 - September 25, 2017 diff --git a/platform/ios/src/MGLMapView.h b/platform/ios/src/MGLMapView.h index 528606fd4e..06d958185e 100644 --- a/platform/ios/src/MGLMapView.h +++ b/platform/ios/src/MGLMapView.h @@ -253,6 +253,9 @@ MGL_EXPORT IB_DESIGNABLE A view showing legally required copyright notices and telemetry settings, positioned at the bottom-right of the map view. + If you choose to reimplement this view, assign the `-showAttribution:` method + as the action for your view to present the default notices and settings. + @note The Mapbox terms of service, which governs the use of Mapbox-hosted vector tiles and styles, requires these @@ -271,6 +274,15 @@ MGL_EXPORT IB_DESIGNABLE */ @property (nonatomic, readonly) UIButton *attributionButton; +/** + Show the attribution and telemetry action sheet. + + This action is performed when the user taps on the attribution button provided + by default via the `attributionButton` property. If you implement a custom + attribution button, you should add this action to the button. + */ +- (IBAction)showAttribution:(id)sender; + /** Support for style classes has been removed. This property always returns an empty array. */ diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 006792f4bf..3288a93ab4 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -503,7 +503,7 @@ public: #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 if ([_attributionButton respondsToSelector:@selector(accessibilityIgnoresInvertColors)]) { _attributionButton.accessibilityIgnoresInvertColors = YES; } #endif - [_attributionButton addTarget:self action:@selector(showAttribution) forControlEvents:UIControlEventTouchUpInside]; + [_attributionButton addTarget:self action:@selector(showAttribution:) forControlEvents:UIControlEventTouchUpInside]; _attributionButton.translatesAutoresizingMaskIntoConstraints = NO; [self addSubview:_attributionButton]; _attributionButtonConstraints = [NSMutableArray array]; @@ -2025,7 +2025,7 @@ public: #pragma mark - Attribution - -- (void)showAttribution +- (void)showAttribution:(__unused id)sender { NSString *title = NSLocalizedStringWithDefaultValue(@"SDK_NAME", nil, nil, @"Mapbox iOS SDK", @"Action sheet title"); UIAlertController *attributionController = [UIAlertController alertControllerWithTitle:title -- cgit v1.2.1