Skip to content

Commit fc39fad

Browse files
committed
Fix: CSS background-image on Label not loading in iOS
Resolves NativeScript#2414
1 parent ff71e6e commit fc39fad

File tree

6 files changed

+19
-3
lines changed

6 files changed

+19
-3
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Label {
2+
background-image: url('~/ui-tests-app/pages/test2.png');
3+
background-repeat: no-repeat;
4+
background-position: left;
5+
background-size: contain;
6+
margin: 10;
7+
border-width: 1;
8+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Page>
2+
<StackLayout>
3+
<Label text="Label1"/>
4+
<Label text="Label2" width="150" height="200" />
5+
<Label text="Label3" width="200" height="150"/>
6+
</StackLayout>
7+
</Page>

apps/app/ui-tests-app/css/main-page.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export function pageLoaded(args: EventData) {
2424
examples.set("zindex", "css/zindex");
2525
examples.set("clipPath", "css/clip-path");
2626
examples.set("padding", "css/padding");
27+
examples.set("label-background-image", "css/label-background-image");
2728

2829
let viewModel = new SubMianPageViewModel(wrapLayout, examples);
2930
page.bindingContext = viewModel;

apps/app/ui-tests-app/web-view/web-view-test.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<!-- WebView: local and string -->
55
<WebView src="~/ui-tests-app/web-view/test.html" height="50" />
6-
<WebView src="&lt;html&gt;&lt;body&gt;&lt;img src='./pages/test2.png'&gt;&lt;/img&gt;&lt;/body&gt;&lt;/html&gt;" height="75" />
6+
<WebView src="&lt;html&gt;&lt;body&gt;&lt;img src='./ui-tests-app/pages/test2.png'&gt;&lt;/img&gt;&lt;/body&gt;&lt;/html&gt;" height="75" />
77

88
<!-- Resources: png and jpg -->
99
<WrapLayout>

apps/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"version": "2.1.1"
1010
},
1111
"tns-ios": {
12-
"version": "2.1.0"
12+
"version": "2.1.1"
1313
}
1414
},
1515
"dependencies": {

tns-core-modules/ui/styling/background.ios.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export module ios {
9494
UIGraphicsBeginImageContextWithOptions(originalImage.size, false, 0.0);
9595
var context = UIGraphicsGetCurrentContext();
9696
CGContextSaveGState(context);
97-
CGContextTranslateCTM(context, 0.0, originalImage.size.width);
97+
CGContextTranslateCTM(context, 0.0, originalImage.size.height);
9898
CGContextScaleCTM(context, 1.0, -1.0);
9999
originalImage.drawInRect(CGRectMake(0, 0, originalImage.size.width, originalImage.size.height))
100100
CGContextRestoreGState(context);

0 commit comments

Comments
 (0)