[ios] Fix iOS 8 incompatibility in scale bar RTL check

This commit is contained in:
Jason Wray
2017-10-19 11:40:30 -04:00
parent 61ea2f43e4
commit 2857090cf6
2 changed files with 9 additions and 3 deletions

View File

@@ -39,6 +39,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
* Fixed an issue that could cause a crash when using `-[MGLMapView flyToCamera:completionHandler:]` and related methods with zoom levels at or near the maximum value. ([#9381](https://github.com/mapbox/mapbox-gl-native/pull/9381))
* Added `-[MGLMapView showAttribution:]` to allow custom attribution buttons to show the default attribution interface. ([#10085](https://github.com/mapbox/mapbox-gl-native/pull/10085))
* Fixed a conflict between multiple copies of SMCalloutView in a project. ([#10183](https://github.com/mapbox/mapbox-gl-native/pull/10183))
* Fixed a crash when enabling the scale bar in iOS 8. ([#10241](https://github.com/mapbox/mapbox-gl-native/pull/10241))
## 3.6.4 - September 25, 2017

View File

@@ -175,10 +175,15 @@ static const CGFloat MGLFeetPerMeter = 3.28084;
return [self usesMetricSystem] ? self.metersPerPoint : self.metersPerPoint * MGLFeetPerMeter;
}
#pragma mark - Convenient methods
#pragma mark - Convenience methods
- (BOOL)usesRightToLeftLayout {
return [UIView userInterfaceLayoutDirectionForSemanticContentAttribute:self.superview.semanticContentAttribute] == UIUserInterfaceLayoutDirectionRightToLeft;
// semanticContentAttribute is iOS 9+
if ([self.superview respondsToSelector:@selector(semanticContentAttribute)]) {
return [UIView userInterfaceLayoutDirectionForSemanticContentAttribute:self.superview.semanticContentAttribute] == UIUserInterfaceLayoutDirectionRightToLeft;
} else {
return UIApplication.sharedApplication.userInterfaceLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft;
}
}
- (BOOL)usesMetricSystem {
@@ -244,7 +249,7 @@ static const CGFloat MGLFeetPerMeter = 3.28084;
CGFloat alpha = maximumDistance > allowedDistance ? .0f : 1.0f;
if(self.alpha != alpha) {
if (self.alpha != alpha) {
[UIView animateWithDuration:.2f delay:0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{
self.alpha = alpha;
} completion:nil];