I know this has been asked many times but I can not get it to work. In short my UIWebview pulls in some HTML which has a none fixed height (width always the same), I just want the height to change accordingly.
I have tried a number of fixes I have found online but my problem is the webview will change to the correct size but only for a brief second and then in flicks back to the original size.
I should point out that my this view is invoked by a segue, that is the only thing I can think is different! I am wondering if the code works but when the segue finishes it's crossfade, flip or whatever it then redraws the webview.
Here is my current code (as I say I have tried many fixes including the Java versions most of which do the same), I have also played with scalesPageToFit and srollEnabled plus a few of the ticks in the Storyboard.
-(void)webViewDidFinishLoad:(UIWebView *)webView
{
NSLog(@"Starting Size : %f", headerWebView.frame.size.height);
headerWebView.scalesPageToFit = YES;
headerWebView.scrollView.scrollEnabled = NO;
CGRect frame = headerWebView.frame;
frame.size.width = frame.size.width; // I used this to test, I put 200 in and it changes then flicks back too
frame.size.height = 1;
headerWebView.frame = frame;
frame.size.height = headerWebView.scrollView.contentSize.height;
headerWebView.frame = frame;
NSLog(@"Finished Size : %f", headerWebView.frame.size.height);
}
The logs say;
Starting Size : 176.000000 Finished Size : 246.000000
Anyone got an idea as to why the Webview appears fine just long enough for me to notice and then "shrink" back?