[ios] Specify ultra light weight literally (#5497)

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.
This commit is contained in:
Minh Nguyễn
2016-06-28 10:03:55 -07:00
committed by GitHub
parent 72c342284c
commit c96b7dae68

View File

@@ -579,8 +579,9 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
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,