The Cook The Cook - 5 months ago 18
Objective-C Question

UIWebView redraws on view did appear, how can I prevent this?

I am working on a app using

now getting a issue listed below please help me to sort it out.

  • In my UIWebView, I show some HTML content from String in it.

  • However, when I go to another
    and return back, it goes white for a second then draws my HTML content again.

Is there any way to prevent this? My html content does not change, so can I set it as fixed content or something to draw it faster ?

This is how I set html in webview:

webView.loadHTMLString(htmlData, baseURL: nil)


Your HTMl code is not changing, so that put your webView load code inside viewDidLoad instead of viewDidAppear, because viewDidAppear always call when your view is appear, where as viewDidLoad called single time when your view is load.