Fix: CSS background-image on Label not loading in iOS

Resolves #2414
This commit is contained in:
Rossen Hristov
2016-07-21 09:44:20 +03:00
parent ff71e6ebee
commit fc39fad959
6 changed files with 19 additions and 3 deletions

View File

@ -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;
}

View File

@ -0,0 +1,7 @@
<Page>
<StackLayout>
<Label text="Label1"/>
<Label text="Label2" width="150" height="200" />
<Label text="Label3" width="200" height="150"/>
</StackLayout>
</Page>

View File

@ -24,6 +24,7 @@ export function pageLoaded(args: EventData) {
examples.set("zindex", "css/zindex"); examples.set("zindex", "css/zindex");
examples.set("clipPath", "css/clip-path"); examples.set("clipPath", "css/clip-path");
examples.set("padding", "css/padding"); examples.set("padding", "css/padding");
examples.set("label-background-image", "css/label-background-image");
let viewModel = new SubMianPageViewModel(wrapLayout, examples); let viewModel = new SubMianPageViewModel(wrapLayout, examples);
page.bindingContext = viewModel; page.bindingContext = viewModel;

View File

@ -3,7 +3,7 @@
<!-- WebView: local and string --> <!-- WebView: local and string -->
<WebView src="~/ui-tests-app/web-view/test.html" height="50" /> <WebView src="~/ui-tests-app/web-view/test.html" height="50" />
<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" /> <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" />
<!-- Resources: png and jpg --> <!-- Resources: png and jpg -->
<WrapLayout> <WrapLayout>

View File

@ -9,7 +9,7 @@
"version": "2.1.1" "version": "2.1.1"
}, },
"tns-ios": { "tns-ios": {
"version": "2.1.0" "version": "2.1.1"
} }
}, },
"dependencies": { "dependencies": {

View File

@ -94,7 +94,7 @@ export module ios {
UIGraphicsBeginImageContextWithOptions(originalImage.size, false, 0.0); UIGraphicsBeginImageContextWithOptions(originalImage.size, false, 0.0);
var context = UIGraphicsGetCurrentContext(); var context = UIGraphicsGetCurrentContext();
CGContextSaveGState(context); CGContextSaveGState(context);
CGContextTranslateCTM(context, 0.0, originalImage.size.width); CGContextTranslateCTM(context, 0.0, originalImage.size.height);
CGContextScaleCTM(context, 1.0, -1.0); CGContextScaleCTM(context, 1.0, -1.0);
originalImage.drawInRect(CGRectMake(0, 0, originalImage.size.width, originalImage.size.height)) originalImage.drawInRect(CGRectMake(0, 0, originalImage.size.width, originalImage.size.height))
CGContextRestoreGState(context); CGContextRestoreGState(context);