Flash. Objective-C. Mobile. Tablets.

Content size of UIWebView is wrong after setFrame when orientation changed

I have the a full screen UIWebView on my ipad app.

When it changes its orientation, I use setFrame to reset the frame size of the UIWebView.

This works sometimes, not always!

1) If the application starts in Portrait, I rotate to landscape, ok no problem, then rotate to Portrait again, ok, still no problem.

2) But if the application starts in Landscape, when I rotate to Portrait, the frame is changed but the content is still in Bigger than the portrait window. I can see horizontal scrollbar for the UIWebview.

Add one line in HTML to fix this:

<meta name=”viewport” content=”width=device-width” />

Found this solution from UIWebView dones’t resize correctly when orientation change ? – Stack Overflow.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.