diff options
author | Jason Wray <friedbunny@users.noreply.github.com> | 2019-09-16 09:19:51 -0700 |
---|---|---|
committer | Julian Rex <julian.rex@mapbox.com> | 2019-09-16 12:19:51 -0400 |
commit | cb8b3c454e678cdfa349eb3957b16cfbaf538dab (patch) | |
tree | a227b84cf8f38f6a7278955851d2d5724366afc3 /platform/ios/src/MGLCompassButton.mm | |
parent | 2afda968c77d776671db86183c3f6ea3a55ffcb3 (diff) | |
download | qtlocation-mapboxgl-cb8b3c454e678cdfa349eb3957b16cfbaf538dab.tar.gz |
[ios] iOS 13 cherry-picks for ios-v5.3.1 (queso) (#15612)
* [ios] Fix compass font weight being too light on iOS 13
* [ios] Allow MGLScaleBar to support dark mode on iOS 13
Add changelog PR link
* [ios] Refactor way location permissions are requested
Diffstat (limited to 'platform/ios/src/MGLCompassButton.mm')
-rw-r--r-- | platform/ios/src/MGLCompassButton.mm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/platform/ios/src/MGLCompassButton.mm b/platform/ios/src/MGLCompassButton.mm index 94a6820a74..acb25a560c 100644 --- a/platform/ios/src/MGLCompassButton.mm +++ b/platform/ios/src/MGLCompassButton.mm @@ -63,9 +63,16 @@ UIImage *scaleImage = [UIImage mgl_resourceImageNamed:@"Compass"]; UIGraphicsBeginImageContextWithOptions(scaleImage.size, NO, UIScreen.mainScreen.scale); [scaleImage drawInRect:{CGPointZero, scaleImage.size}]; + + UIFont *northFont; + if (@available(iOS 13.0, *)) { + northFont = [UIFont systemFontOfSize:11 weight:UIFontWeightLight]; + } else { + northFont = [UIFont systemFontOfSize:11 weight:UIFontWeightUltraLight]; + } NSAttributedString *north = [[NSAttributedString alloc] initWithString:NSLocalizedStringWithDefaultValue(@"COMPASS_NORTH", nil, nil, @"N", @"Compass abbreviation for north") attributes:@{ - NSFontAttributeName: [UIFont systemFontOfSize:11 weight:UIFontWeightUltraLight], + NSFontAttributeName: northFont, NSForegroundColorAttributeName: [UIColor whiteColor], }]; CGRect stringRect = CGRectMake((scaleImage.size.width - north.size.width) / 2, |