问题
I want to reload a UIWebView
(including all labels and images) when a button is tapped. How can I do that?
回答1:
- (void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
[webView reload];
}
or
NSURL *theURL = [NSURL URLWithString:@"http://www.OurLovingMother.org/Mobile.aspx"];
[webView loadRequest:[NSURLRequest requestWithURL:theURL]];
}
回答2:
- (IBAction)buttonClicked
{
[yourWebview reload];
}
Hope this helps
回答3:
Note that if you load the content of your UIWebView
using loadHTMLString:
then you'll need to call loadHTMLString:
again to reload it. In this case the reload
method doesn't work.
回答4:
You can try
[webView reload];
in your click handler.
来源:https://stackoverflow.com/questions/5878832/how-to-reload-a-uiwebview