Reused UIWebView showing previous loaded content for a brief second on iPhone

Posted by Roi on Stack Overflow See other posts from Stack Overflow or by Roi
Published on 2010-02-22T14:43:32Z Indexed on 2010/04/08 5:03 UTC
Read the original article Hit count: 361

Filed under:
|

In one of my apps I reuse a webview. Each time the user enters a certain view on reload cached data to the webview using the method - (void)loadData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)encodingName baseURL:(NSURL *)baseURL and I wait for the callback call - (void) webViewDidFinishLoad:(UIWebView *)webView. In the mean time I hide the webview and show a 'loading' label. Only when I receive webViewDidFinishLoad do I show the webview.

Many times what happens is I see the previous data that was loaded to the webview for a brief second before the new data I loaded kicks in.

I already added a delay of 0.2 seconds before showing the webview but it didn't help.

Instead of solving this by adding more time to the delay does anyone know how to solve this issue or maybe clear old data from a webview without release and allocating it every time?

© Stack Overflow or respective owner

Related posts about uiwebview

Related posts about iphone