xcode 如何重新加载或刷新 web 视图

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3950205/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 19:50:27  来源:igfitidea点击:

How do I reload or refresh a webview

iphonexcodeuiwebview

提问by andy

... with a button outside of the uiwebview? please see screenshot attached.

...在 uiwebview 之外有一个按钮?请参阅附件截图。

the thing is, that I have a local html site in the webview, that goes to further local web sites. I want the user to be able to get back to the "home page" of the local website by clicking on the "home" button on the top, which is not part of the uiwebview.

问题是,我在 webview 中有一个本地 html 站点,它可以访问更多本地网站。我希望用户能够通过单击顶部的“主页”按钮返回本地网站的“主页”,这不是 uiwebview 的一部分。

(my xcode status is beginner.)

(我的 xcode 状态是初学者。)

thanks for help.

感谢帮助。

采纳答案by AppAspect

You can refresh the webview by calling loadRequestmethod under the UIWebViewclass.

可以通过调用类loadRequest下的方法来刷新webview UIWebView

[webView loadRequest:[NSURLRequest requestWithURL:theURL]];

You have to pass your url in theURL. So, you will get the refreshed page.

你必须在theURL. 因此,您将获得刷新后的页面。