Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How To Clear A UIWebView

Tags:

ios

uiwebview

I am very new to the whole programming business, and was wondering if there is any way to clear the contents of a UIWebView in iphone programming, so that the loading symbol for the next view is not showing up in front of the last view. Many Thanks, Thomas

like image 882
Tom Cuzz Avatar asked Jul 04 '11 21:07

Tom Cuzz


People also ask

How can I clear the contents of a UIWebView WKWebView?

To clear old contents of webview With UIWebView you would use UIWebViewDelegate 's - webViewDidFinishLoad: .

What is UIWebView on Apple iPhone?

A view that embeds web content in your app.

What is the difference between UIWebView and WKWebView?

Difference Between UIWebview and WKWebViewUIWebview is a part of UIKit, so it is available to your apps as standard. You don't need to import anything, it will we there by default. But WKWebView is run in a separate process to your app,. You need to import Webkit to use WKWebView in your app.


2 Answers

Try setting the URL to about:blank and reload the page.

like image 143
Constantino Tsarouhas Avatar answered Sep 23 '22 08:09

Constantino Tsarouhas


Just load an empty html string into it

[self.webView loadHTMLString:@"" baseURL:nil];

like image 34
2cupsOfTech Avatar answered Sep 20 '22 08:09

2cupsOfTech