Posted by Doug Hays on the 22nd of September, 2010 at 9:04 am under iPhone Development.    This post has no comments.

I had the simplest of UIWebView implementations throwing me an odd issue. It was an iPad app with a UIWebView, stretched to fill the entire screen, loaded from a local HTML file.

If the view was loaded in landscape and then rotated to portrait, the content size of the web view would remain at 1024 pixels wide even though the HTML content only took up 700px.

I finally found a helpful post that suggested I add the following inside the HEAD tag of my HTML:

<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;">

That does the trick!

Sorry, but commenting on this post is disabled.