How to reload a UIWebView?

耗尽温柔 提交于 2020-01-12 05:07:40

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!