Note that there are some explanatory texts on larger screens.

plurals
  1. POUIWebView rotation on iPad
    primarykey
    data
    text
    <p>On the iPad, I present a view in the "detail" side of a split view controller that is basically just a <code>UIWebView</code>, which loads an HTML file in the application bundle. The application supports rotation and hides/shows the "master" side of the split as appropriate.</p> <p>When the <code>UIWebView</code> is initially loaded in landscape mode, its content seems to be "sized" properly... the content is taller than the screen, so you can scroll vertically, but not horizontally. (The HTML content is nearly all text styled with CSS, with only a small ~300x50 image at the bottom.)</p> <p>If you then rotate the screen to portrait, the HTML content still seems to be sized okay -- vertical scrollbar is present, but not horizontal, as it was initially. Rotating back to landscape and everything is still peachy.</p> <p>So far, so good.</p> <p>Now, if the <code>UIWebView</code> initially loads in portrait orientation, everything is also "sized" properly (vertical scrollbar, no horizontal). But, if you rotate it to landscape, the content suddenly gets a horizontal scrollbar, because one of the paragraphs of text is wider than the width of the UIWebView. (Not coincidentally, I'm sure, but that long paragraph is sized perfectly for the slightly larger width the <code>UIWebView</code> has when it's oriented as portrait.)</p> <p>I was expecting/assuming that rotation of the iPad would cause the <code>UIWebView</code> to have its frame be resized, and when it's resized, to also resize its HTML content appropriately. (Think of taking a Web browser window and shrinking it.) Why isn't that happening for me?</p> <p>I would like to avoid using the "Scales Pages to Fit" property because the text shrinks non-deterministically.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload