diff options
author | Jason Wray <jason@mapbox.com> | 2017-12-06 11:43:06 -0500 |
---|---|---|
committer | Jason Wray <jason@mapbox.com> | 2017-12-07 19:01:04 -0500 |
commit | c0ad7be3888452391539f87ed46dea370babc645 (patch) | |
tree | 108841d66ba4f2d1ef8c5f278546e214023c5ce7 /platform/ios/src/MGLMapView.mm | |
parent | a0199efa9a5b9a19f0f9209ae22e4c145138b9f7 (diff) | |
download | qtlocation-mapboxgl-c0ad7be3888452391539f87ed46dea370babc645.tar.gz |
[ios] Long-press attribution button to show SDK version
Diffstat (limited to 'platform/ios/src/MGLMapView.mm')
-rw-r--r-- | platform/ios/src/MGLMapView.mm | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 87b1a1c14e..7163302091 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -455,6 +455,9 @@ public: _attributionButtonConstraints = [NSMutableArray array]; [_attributionButton addObserver:self forKeyPath:@"hidden" options:NSKeyValueObservingOptionNew context:NULL]; + UILongPressGestureRecognizer *attributionLongPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(showAttribution:)]; + [_attributionButton addGestureRecognizer:attributionLongPress]; + // setup compass // _compassView = [[UIImageView alloc] initWithImage:self.compassImage]; @@ -1973,13 +1976,28 @@ public: #pragma mark - Attribution - -- (void)showAttribution:(__unused id)sender +- (void)showAttribution:(id)sender { + BOOL shouldShowVersion = [sender isKindOfClass:[UILongPressGestureRecognizer class]]; + if (shouldShowVersion) + { + UILongPressGestureRecognizer *longPress = (UILongPressGestureRecognizer *)sender; + if (longPress.state != UIGestureRecognizerStateBegan) + { + return; + } + } + NSString *title = NSLocalizedStringWithDefaultValue(@"SDK_NAME", nil, nil, @"Mapbox Maps SDK for iOS", @"Action sheet title"); UIAlertController *attributionController = [UIAlertController alertControllerWithTitle:title message:nil preferredStyle:UIAlertControllerStyleActionSheet]; - + + if (shouldShowVersion) + { + attributionController.title = [title stringByAppendingFormat:@" %@", [NSBundle mgl_frameworkInfoDictionary][@"MGLSemanticVersionString"]]; + } + NSArray *attributionInfos = [self.style attributionInfosWithFontSize:[UIFont buttonFontSize] linkColor:nil]; for (MGLAttributionInfo *info in attributionInfos) |