From c96b7dae687f43a7ca233698554aa33eb3180f0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Tue, 28 Jun 2016 10:03:55 -0700 Subject: [PATCH] [ios] Specify ultra light weight literally (#5497) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed a crash on iOS 8.1 and below due to specifying the compass legend’s font weight using a font weight constant that was introduced in iOS 8.2. Fixes #5486. --- platform/ios/src/MGLMapView.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 19f5e425ef7..25cf23c8789 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -579,8 +579,9 @@ - (UIImage *)compassImage UIGraphicsBeginImageContextWithOptions(scaleImage.size, NO, [UIScreen mainScreen].scale); [scaleImage drawInRect:{ CGPointZero, scaleImage.size }]; + CGFloat weight = &UIFontWeightUltraLight ? UIFontWeightUltraLight : -0.8; NSAttributedString *north = [[NSAttributedString alloc] initWithString:NSLocalizedStringWithDefaultValue(@"COMPASS_NORTH", nil, nil, @"N", @"Compass abbreviation for north") attributes:@{ - NSFontAttributeName: [UIFont systemFontOfSize:9 weight:UIFontWeightUltraLight], + NSFontAttributeName: [UIFont systemFontOfSize:9 weight:weight], NSForegroundColorAttributeName: [UIColor whiteColor], }]; CGRect stringRect = CGRectMake((scaleImage.size.width - north.size.width) / 2,