summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Wray <jason@mapbox.com>2017-09-28 16:47:54 -0400
committerJason Wray <jason@mapbox.com>2017-10-02 12:38:00 -0700
commit1326a21dddd9f593489202a7f98a12b8af2c5a05 (patch)
treef0f752d3fd0bafc23f8adae82c8c387edf5bd435
parent3d2e4e5b5a85cde38b40cc2d8b70215bbc53ff04 (diff)
downloadqtlocation-mapboxgl-1326a21dddd9f593489202a7f98a12b8af2c5a05.tar.gz
[ios] Expose -showAttribution: publicly as an IBAction
-rw-r--r--platform/ios/CHANGELOG.md1
-rw-r--r--platform/ios/src/MGLMapView.h12
-rw-r--r--platform/ios/src/MGLMapView.mm4
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,
<a href="https://www.mapbox.com/help/attribution/">requires</a> these
@@ -272,6 +275,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.
*/
@property (nonatomic) NS_ARRAY_OF(NSString *) *styleClasses __attribute__((deprecated("This property is non-functional.")));
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