Search code examples
iosipaduiwebviewrotation

UIWebView - Does not resize content on rotation change?


So I have a UIWebView that displays static html content.

When I start the ViewController in portrait and switch to landscape, it resizes the content correctly.

But, when I start the page in landscape and switch to portrait, it doesn't resize my content, and scrolling is required in order to view all the content.

Is this a bug? Is there a solution to force resizing the content of a UIWebView?


Solution

  • You have 2 options:
    Add this into HEAD section of your html file:

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

    Or call [myWebView reload] when orientation changes