From fc39fad959cbaad9307d9a81c0d186ca8bfda89c Mon Sep 17 00:00:00 2001 From: Rossen Hristov Date: Thu, 21 Jul 2016 09:44:20 +0300 Subject: [PATCH] Fix: CSS background-image on Label not loading in iOS Resolves #2414 --- apps/app/ui-tests-app/css/label-background-image.css | 8 ++++++++ apps/app/ui-tests-app/css/label-background-image.xml | 7 +++++++ apps/app/ui-tests-app/css/main-page.ts | 1 + apps/app/ui-tests-app/web-view/web-view-test.xml | 2 +- apps/package.json | 2 +- tns-core-modules/ui/styling/background.ios.ts | 2 +- 6 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 apps/app/ui-tests-app/css/label-background-image.css create mode 100644 apps/app/ui-tests-app/css/label-background-image.xml diff --git a/apps/app/ui-tests-app/css/label-background-image.css b/apps/app/ui-tests-app/css/label-background-image.css new file mode 100644 index 000000000..f0eab9e94 --- /dev/null +++ b/apps/app/ui-tests-app/css/label-background-image.css @@ -0,0 +1,8 @@ +Label { + background-image: url('~/ui-tests-app/pages/test2.png'); + background-repeat: no-repeat; + background-position: left; + background-size: contain; + margin: 10; + border-width: 1; +} \ No newline at end of file diff --git a/apps/app/ui-tests-app/css/label-background-image.xml b/apps/app/ui-tests-app/css/label-background-image.xml new file mode 100644 index 000000000..f918bce05 --- /dev/null +++ b/apps/app/ui-tests-app/css/label-background-image.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/apps/app/ui-tests-app/css/main-page.ts b/apps/app/ui-tests-app/css/main-page.ts index 1dd8ceb1d..e4531ace5 100644 --- a/apps/app/ui-tests-app/css/main-page.ts +++ b/apps/app/ui-tests-app/css/main-page.ts @@ -24,6 +24,7 @@ export function pageLoaded(args: EventData) { examples.set("zindex", "css/zindex"); examples.set("clipPath", "css/clip-path"); examples.set("padding", "css/padding"); + examples.set("label-background-image", "css/label-background-image"); let viewModel = new SubMianPageViewModel(wrapLayout, examples); page.bindingContext = viewModel; diff --git a/apps/app/ui-tests-app/web-view/web-view-test.xml b/apps/app/ui-tests-app/web-view/web-view-test.xml index 3e5c85348..a99501128 100644 --- a/apps/app/ui-tests-app/web-view/web-view-test.xml +++ b/apps/app/ui-tests-app/web-view/web-view-test.xml @@ -3,7 +3,7 @@ - + diff --git a/apps/package.json b/apps/package.json index a6d23c7f1..c5f563c87 100644 --- a/apps/package.json +++ b/apps/package.json @@ -9,7 +9,7 @@ "version": "2.1.1" }, "tns-ios": { - "version": "2.1.0" + "version": "2.1.1" } }, "dependencies": { diff --git a/tns-core-modules/ui/styling/background.ios.ts b/tns-core-modules/ui/styling/background.ios.ts index c657a4a89..681fe027f 100644 --- a/tns-core-modules/ui/styling/background.ios.ts +++ b/tns-core-modules/ui/styling/background.ios.ts @@ -94,7 +94,7 @@ export module ios { UIGraphicsBeginImageContextWithOptions(originalImage.size, false, 0.0); var context = UIGraphicsGetCurrentContext(); CGContextSaveGState(context); - CGContextTranslateCTM(context, 0.0, originalImage.size.width); + CGContextTranslateCTM(context, 0.0, originalImage.size.height); CGContextScaleCTM(context, 1.0, -1.0); originalImage.drawInRect(CGRectMake(0, 0, originalImage.size.width, originalImage.size.height)) CGContextRestoreGState(context);