Search code examples
iphoneobjective-cuiwebviewrefreshreload

How to reload already loaded uiwebview with new HTML string?


I have implemented UIWebView in my project to show some HTML data. The problem is I have loaded the webview with some HTML string by using the method

[myWebView loadHTMLString:Data baseURL:nil];

Now I want to add action of button such that when user click on the button the new data is loaded in the webview. such that

-(void)clicked{
[myWebView loadHTMLString:newData baseURL:nil];
}

I tried by applying the same as above but no affect was there. I also tried [myWebView reload], but nothing happened.

Plz tell me the appropriate method.


Solution

  • TRy with, First call stopLoading then reload on your UIWebView instance.

    [myWebView  stopLoading ];
    [myWebView  reload];