Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[ios] Specify ultra light weight literally (#5497)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
1ec5 authored Jun 28, 2016
1 parent 72c3422 commit c96b7da
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion platform/ios/src/MGLMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit c96b7da

Please sign in to comment.