diff options
author | Lloyd Sheng <i@lloydsheng.com> | 2019-03-13 13:44:51 +0800 |
---|---|---|
committer | Lloyd Sheng <i@lloydsheng.com> | 2019-03-13 13:44:51 +0800 |
commit | e890af196c5c8a348c53fdf4158cba012d0f609e (patch) | |
tree | 0f6e3f96746e5765d39e8fc411262f85109971c5 /platform/ios/app/MBXOrnamentsViewController.m | |
parent | 0a0464639cdd72db8f0d483932a1f95516d096c5 (diff) | |
download | qtlocation-mapboxgl-e890af196c5c8a348c53fdf4158cba012d0f609e.tar.gz |
Fix issues found in reviewupstream/lloyd-ornament-position
Diffstat (limited to 'platform/ios/app/MBXOrnamentsViewController.m')
-rw-r--r-- | platform/ios/app/MBXOrnamentsViewController.m | 75 |
1 files changed, 38 insertions, 37 deletions
diff --git a/platform/ios/app/MBXOrnamentsViewController.m b/platform/ios/app/MBXOrnamentsViewController.m index 489b3062b6..45288af0ab 100644 --- a/platform/ios/app/MBXOrnamentsViewController.m +++ b/platform/ios/app/MBXOrnamentsViewController.m @@ -13,43 +13,44 @@ @implementation MBXOrnamentsViewController - (void)setCurrentPositionIndex:(NSInteger)currentPositionIndex { - NSArray *ornamentPositions = @[@[ - @(MGLOrnamentPositionTopLeft), - @(MGLOrnamentPositionTopRight), - @(MGLOrnamentPositionBottomRight), - @(MGLOrnamentPositionBottomLeft) - ], - @[ - @(MGLOrnamentPositionTopRight), - @(MGLOrnamentPositionBottomRight), - @(MGLOrnamentPositionBottomLeft), - @(MGLOrnamentPositionTopLeft) - ], - @[ - @(MGLOrnamentPositionBottomRight), - @(MGLOrnamentPositionBottomLeft), - @(MGLOrnamentPositionTopLeft), - @(MGLOrnamentPositionTopRight) - ], - @[ - @(MGLOrnamentPositionBottomLeft), - @(MGLOrnamentPositionTopLeft), - @(MGLOrnamentPositionTopRight), - @(MGLOrnamentPositionBottomRight) - ], - @[ - @(MGLOrnamentPositionTopLeft), - @(MGLOrnamentPositionTopRight), - @(MGLOrnamentPositionBottomRight), - @(MGLOrnamentPositionBottomLeft) - ], - ]; - NSArray *currentPosition = ornamentPositions[currentPositionIndex]; - self.mapView.scaleBarPosition = [currentPosition[0] integerValue]; - self.mapView.compassViewPosition = [currentPosition[1] integerValue]; - self.mapView.logoViewPosition = [currentPosition[2] integerValue]; - self.mapView.attributionButtonPosition = [currentPosition[3] integerValue]; - + MGLOrnamentPosition ornamentPositions[5][4] = { + { + MGLOrnamentPositionTopLeft, + MGLOrnamentPositionTopRight, + MGLOrnamentPositionBottomRight, + MGLOrnamentPositionBottomLeft + }, + { + MGLOrnamentPositionTopRight, + MGLOrnamentPositionBottomRight, + MGLOrnamentPositionBottomLeft, + MGLOrnamentPositionTopLeft + }, + { + MGLOrnamentPositionBottomRight, + MGLOrnamentPositionBottomLeft, + MGLOrnamentPositionTopLeft, + MGLOrnamentPositionTopRight + }, + { + MGLOrnamentPositionBottomLeft, + MGLOrnamentPositionTopLeft, + MGLOrnamentPositionTopRight, + MGLOrnamentPositionBottomRight + }, + { + MGLOrnamentPositionTopLeft, + MGLOrnamentPositionTopRight, + MGLOrnamentPositionBottomRight, + MGLOrnamentPositionBottomLeft + } + }; + MGLOrnamentPosition *currentPosition = ornamentPositions[currentPositionIndex]; + self.mapView.scaleBarPosition = currentPosition[0]; + self.mapView.compassViewPosition = currentPosition[1]; + self.mapView.logoViewPosition = currentPosition[2]; + self.mapView.attributionButtonPosition = currentPosition[3]; + _currentPositionIndex = currentPositionIndex; } |