summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Guerra <fabian.guerra@mapbox.com>2019-08-20 10:21:17 -0700
committerFabian Guerra <fabian.guerra@mapbox.com>2019-08-20 12:26:07 -0700
commitf5a9b0e07336e8155c45e79c081b7db679f47784 (patch)
treedcfd138be53a14a481c33d87b08714c8cdca6760
parent90e26244a507175993097bac85cd0abab268bffe (diff)
downloadqtlocation-mapboxgl-upstream/fabian-test-padding.tar.gz
[ios] Padding test.upstream/fabian-test-padding
-rw-r--r--platform/ios/app/Assets.xcassets/background.imageset/Contents.json21
-rw-r--r--platform/ios/app/Assets.xcassets/background.imageset/backgroung.sdf.pngbin0 -> 240 bytes
-rw-r--r--platform/ios/app/Info.plist2
-rw-r--r--platform/ios/app/MBXViewController.m24
-rw-r--r--platform/ios/ios.xcodeproj/project.pbxproj4
5 files changed, 46 insertions, 5 deletions
diff --git a/platform/ios/app/Assets.xcassets/background.imageset/Contents.json b/platform/ios/app/Assets.xcassets/background.imageset/Contents.json
new file mode 100644
index 0000000000..7800a00a58
--- /dev/null
+++ b/platform/ios/app/Assets.xcassets/background.imageset/Contents.json
@@ -0,0 +1,21 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "filename" : "backgroung.sdf.png",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+} \ No newline at end of file
diff --git a/platform/ios/app/Assets.xcassets/background.imageset/backgroung.sdf.png b/platform/ios/app/Assets.xcassets/background.imageset/backgroung.sdf.png
new file mode 100644
index 0000000000..777c75beb4
--- /dev/null
+++ b/platform/ios/app/Assets.xcassets/background.imageset/backgroung.sdf.png
Binary files differ
diff --git a/platform/ios/app/Info.plist b/platform/ios/app/Info.plist
index c302f306a6..a299172fa8 100644
--- a/platform/ios/app/Info.plist
+++ b/platform/ios/app/Info.plist
@@ -53,6 +53,8 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
+ <key>MGLMapboxAccessToken</key>
+ <string>insert here your token</string>
<key>UIApplicationShortcutItems</key>
<array>
<dict>
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m
index 2fb95e1b17..2bd9f94d7b 100644
--- a/platform/ios/app/MBXViewController.m
+++ b/platform/ios/app/MBXViewController.m
@@ -1111,8 +1111,26 @@ CLLocationCoordinate2D randomWorldCoordinate() {
- (void)styleSymbolLayer
{
- MGLSymbolStyleLayer *stateLayer = (MGLSymbolStyleLayer *)[self.mapView.style layerWithIdentifier:@"state-label-lg"];
- stateLayer.textColor = [NSExpression expressionForConstantValue:[UIColor redColor]];
+ UIImage *background = [UIImage imageNamed:@"background"];
+ UIImage *backgroundSDF = [background imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
+ [self.mapView.style setImage:backgroundSDF forName:@"background"];
+
+ MGLSymbolStyleLayer *symbolStyleLayer = (MGLSymbolStyleLayer *)[self.mapView.style layerWithIdentifier:@"road-intersections"];
+ symbolStyleLayer.iconImageName = [NSExpression expressionForConstantValue:@"background"];
+ symbolStyleLayer.iconTextFit = [NSExpression expressionForConstantValue:[NSValue valueWithMGLIconTextFit:MGLIconTextFitBoth]];
+ symbolStyleLayer.iconScale = [NSExpression expressionForConstantValue:@1.0];
+ UIEdgeInsets padding = UIEdgeInsetsMake(5.0, 5.0, 5.0, 5.0); // padding is evenly distributed
+ symbolStyleLayer.iconTextFitPadding = [NSExpression expressionForConstantValue:[NSValue valueWithUIEdgeInsets:padding]];
+
+ symbolStyleLayer.iconColor = [NSExpression expressionForConstantValue:UIColor.whiteColor];
+ UIColor *haloColor = [UIColor colorWithRed:(51.0/255) green:(117.0/255) blue:(197.0/255) alpha:1.0];
+ symbolStyleLayer.iconHaloColor = [NSExpression expressionForConstantValue:haloColor];
+ symbolStyleLayer.iconHaloWidth = [NSExpression expressionForConstantValue:@4.0];
+
+ symbolStyleLayer.textHaloColor = [NSExpression expressionForConstantValue:UIColor.whiteColor];
+ symbolStyleLayer.textHaloWidth = [NSExpression expressionForConstantValue:@0.5];
+ symbolStyleLayer.textHaloBlur = [NSExpression expressionForConstantValue:@0.5];
+ symbolStyleLayer.textColor = [NSExpression expressionForConstantValue:haloColor];
}
- (void)styleBuildingLayer
@@ -1996,7 +2014,7 @@ CLLocationCoordinate2D randomWorldCoordinate() {
self.styleIndex = (self.styleIndex + 1) % styleNames.count;
- self.mapView.styleURL = styleURLs[self.styleIndex];
+ self.mapView.styleURL = [NSURL URLWithString:@"insert here your url"];
UIButton *titleButton = (UIButton *)self.navigationItem.titleView;
[titleButton setTitle:styleNames[self.styleIndex] forState:UIControlStateNormal];
diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj
index 49043bdeee..9a2f9d8602 100644
--- a/platform/ios/ios.xcodeproj/project.pbxproj
+++ b/platform/ios/ios.xcodeproj/project.pbxproj
@@ -1197,8 +1197,8 @@
CA55CD3E202C16AA00CE7095 /* MGLCameraChangeReason.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLCameraChangeReason.h; sourceTree = "<group>"; };
CA5E5042209BDC5F001A8A81 /* MGLTestUtility.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MGLTestUtility.h; path = ../../darwin/test/MGLTestUtility.h; sourceTree = "<group>"; };
CA65C4F721E9BB080068B0D4 /* MGLCluster.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLCluster.h; sourceTree = "<group>"; };
- CA86FF0D22D8D5A0009EB14A /* MGLNetworkConfigurationTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGLNetworkConfigurationTests.m; sourceTree = "<group>"; };
CA6914B420E67F50002DB0EE /* MGLAnnotationViewIntegrationTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLAnnotationViewIntegrationTests.mm; path = "Annotation Tests/MGLAnnotationViewIntegrationTests.mm"; sourceTree = "<group>"; };
+ CA86FF0D22D8D5A0009EB14A /* MGLNetworkConfigurationTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGLNetworkConfigurationTests.m; sourceTree = "<group>"; };
CA88DC2F21C85D900059ED5A /* MGLStyleURLIntegrationTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGLStyleURLIntegrationTest.m; sourceTree = "<group>"; };
CA8FBC0821A47BB100D1203C /* MGLRendererConfigurationTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLRendererConfigurationTests.mm; path = ../../darwin/test/MGLRendererConfigurationTests.mm; sourceTree = "<group>"; };
CAD9D0A922A86D6F001B25EE /* MGLResourceTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLResourceTests.mm; path = ../../darwin/test/MGLResourceTests.mm; sourceTree = "<group>"; };
@@ -3157,7 +3157,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "$SRCROOT/app/insert_access_token.sh\n";
+ shellScript = "#$SRCROOT/app/insert_access_token.sh\n";
};
07796BA2227908CB0059CAF1 /* Insert Mapbox Access Token */ = {
isa = PBXShellScriptBuildPhase;