Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone - is @2x valid for UIWebView?

Tags:

iphone

I have this UIWebView on my app that shows a local html file. Do the images on that web view follow the @2x rule? I mean, if I build both, the regular and the @2x images will the webview load the retina ones for the iPhone 4?

remember that the images are being loaded by the HTML tag , not by any UIImage method.

thanks.

like image 654
Duck Avatar asked Feb 09 '11 19:02

Duck


2 Answers

Nope. It's not too hard to roll your own though, as WebKit supports this CSS rule:

@media only screen and (-webkit-min-device-pixel-ratio: 2) {
    /* this is a retina display device */
}

You can also use the -webkit-background-size and the usual width and height selectors to ensure the images display at the correct physical size.

like image 64
Jonathan Grynspan Avatar answered Nov 15 '22 09:11

Jonathan Grynspan


Jonathon Grynspan is correct. I recommend reading Aral Balkan's tutorial on the topic. This was what I read when I implemented @2x graphics for a recent mobile site:

How to make your web content look stunning on the iPhone 4’s new Retina display

like image 40
typeoneerror Avatar answered Nov 15 '22 08:11

typeoneerror