I’m having a really confusing problem. I have a UIWebView that is contained within a UIScrollView (I’m using a UIWebView because there are some hard returns that need to be displayed) and to ensure that the app looks “clean” I’m using [UIWebView sizeToFit] after the content of the WebView had loaded.
The problem is that the content is quite large (they are film reviews from a pre-existing website), and after a certain number of pixels (about 512) the WebView just stops drawing. It does, however, correctly adjust the height of the view.
Some Additional Information:
The WebView needs to be of variable size
Even if I set the size manually to be that large, the issue still occurs (not just when I use SizeToFit)
I cannot just use the scrolling ability of the WebView because there is content above and below it that means that it has to be contained within a ScrollView (I would use a label, but there are hard returns in my text)
I don’t think there is anything wrong with my HTML, I will post what I have, below:
body
{
background-color: transparent;
margin-left: 5px;
margin-right: 5px;
font-family: Georgia, sans-serif;
font-size: small;
}
CONTENT GOES HERE GATHERED FROM AN NSSTRING IN AN OBJECT I CREATED
I tested using a standard view (instead of a ScrollView) and this only happens when the WebView’s height is greater than 512 pixels. Anything less than that and it renders all content perfectly
Any ideas? Thanks for your help!
I have fixed my own question! The problem was that I was not resizing the UIView that the WebView was a child of, but instead I was just setting the contentSize of the ScrollView that the View was a child of (if that makes sense…)
So if anybody ever has this issue in the future – ensure you are resizing your UIView correctly!