diff options
author | Jason Wray <jason@mapbox.com> | 2017-02-17 18:47:32 -0500 |
---|---|---|
committer | Jason Wray <jason@mapbox.com> | 2017-02-17 18:47:32 -0500 |
commit | 65b42949c77b4e86db7bf51055e09e160d5a58a1 (patch) | |
tree | e26f9ede7e63b4a07f8270d2bada5d3339b548dd /platform | |
parent | 9924535415cfaa45aa27d613f6141b96c7f16a68 (diff) | |
download | qtlocation-mapboxgl-65b42949c77b4e86db7bf51055e09e160d5a58a1.tar.gz |
[ios] Fix locale-based language switching demo
Copy-pasted the better implementation from macOS.
Diffstat (limited to 'platform')
-rw-r--r-- | platform/ios/app/MBXViewController.m | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index d82bc18f78..118a1ded0f 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -1270,14 +1270,13 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { } else if ([layer.text isKindOfClass:[MGLCameraStyleFunction class]]) { MGLCameraStyleFunction *function = (MGLCameraStyleFunction<NSString *> *)layer.text; - [function.stops enumerateKeysAndObjectsUsingBlock:^(id zoomLevel, id stop, BOOL *done) { - if ([stop isKindOfClass:[MGLStyleConstantValue class]]) { - MGLStyleConstantValue *label = (MGLStyleConstantValue<NSString *> *)stop; - if ([label.rawValue hasPrefix:@"{name"]) { - [function.stops setValue:[MGLStyleValue valueWithRawValue:language] forKey:zoomLevel]; - } + NSMutableDictionary *stops = function.stops.mutableCopy; + [stops enumerateKeysAndObjectsUsingBlock:^(NSNumber *zoomLevel, MGLStyleConstantValue<NSString *> *stop, BOOL *done) { + if ([stop.rawValue hasPrefix:@"{name"]) { + stops[zoomLevel] = [MGLStyleValue<NSString *> valueWithRawValue:language]; } }]; + function.stops = stops; layer.text = function; } } else { |