On the iPad, I present a view in the "detail" side of a split view controller that is basically just a UIWebView
, which loads an HTML file in the application bundle. The application supports rotation and hides/shows the "master" side of the split as appropriate.
When the UIWebView
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.)
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.
So far, so good.
Now, if the UIWebView
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 UIWebView
has when it's oriented as portrait.)
I was expecting/assuming that rotation of the iPad would cause the UIWebView
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?
I would like to avoid using the "Scales Pages to Fit" property because the text shrinks non-deterministically.