I'm using webViewDidFinishLoad
a lot in my app and there's something about UIWebView
that really bugs me, well, actually two things.
The first, when I load new content to a UIWebView
I will see for half a second the last page that was loaded to the same UIWebView
what will force me to "clean" the UIWebView
using something like:
[_mainWebView stringByEvaluatingJavaScriptFromString:@"document.open();document.close();"];
before loading the new content.
The second issue I have and that's the main issue for this question is that if i'll load some new content to my UIWebView
and do something like this:
[_mainWebView loadHTMLString:htmlString baseURL:nil];
...
- (void)webViewDidFinishLoad:(UIWebView *)webView {
_mainWebView.alpha = 1;
}
In some cases the UIWebView
will show up white for half a second before showing up the content. I'm guessing that the content is already loaded into the UIWebView
and that's why webViewDidFinishLoad:webView
is firing but for small html pages showing to content takes loner than the actual load. Is there any workaround I can use to avoid the blank screen that is showing for a sec or so but still save that second?
I thought about animating the alpha from 0 to 1 but that solution feels kinda lame to me.