views:

454

answers:

1

I load a UIWebView from a string in a navigation based app. I'm using this in a UIWebView's header tag:

<meta name="viewport" content="width=320,height=420,user-scalable=yes,initial-scale=1.0">

I use viewport at 1.0 because image sizes don't have to be readjusted, which is the case without viewport. When the phone is rotated to landscape, the window width is clipped severely and I get a black void on the right side. I'd like the view to fill all the landscape space...and for text to fill use this space, rather than wrapping as much as it does in portrait. Is there a way to get that type of formatting?

+2  A: 

You are using scale less than 1 for viewport with width 320, which is strange since the device has enough pixels to show the whole view. What exactly are you trying to get? Do you want the view to occupy just a part of the screen? Not sure if this is going to work with meta, you will need to resize the view itself.

Also, here is the syntax:

<meta name = "viewport" content = "width = 320,
   initial-scale = 2.3, user-scalable = no">

Notice that Apple uses commas while you use semicolons.

If it’s too large in landscape, and you use landscape often, just make it all smaller, and occasionally zoom when in portrait :-)

Ilya Birman
Thanks. The semicolons were definitely wrong. Now the changes are taking affect. I've updated my OP to better communicate what I'm trying to do.
4thSpace
Problem resolved. I have to wait until the rotation is complete and then reload the UIWebView content.
4thSpace