iOS:我想单击选项卡栏项目以始终指向原始 URL
我有一个有 4 个选项卡的应用程序。
这些选项卡之一是 UIWebView。它从特定的 URL 开始。我希望拥有它,以便在通过单击链接等在该 Web 视图中导航后,当您再次单击选项卡项时,它会重新加载原始 URL。我怎样才能做到这一点?
I have an app with 4 tabs.
One of these tabs is a UIWebView. It starts at a particular URL. I would like to have it so that after navigating around in this webview through clicking on links and all that, when you click on the tab item again it reloads the original URL. How could I accomplish this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在包含 UIWebView 的视图控制器的 viewWillAppear 方法中,始终将 URL 设置为原始 URL。
编辑回复:您的评论:
我只是进行了检查,因为我是一个优化狂,讨厌运行不必要的代码。话虽这么说,我确信只要这样做:
就可以了,并且对性能没有明显的影响。
In the
viewWillAppear
method of the view controller that contains the UIWebView, always have it set the URL to the original.Edit Re: Your comments:
I only put the checks in because I'm an optimizing fiend and hate running code unnecessarily. That being said, I'm sure just doing:
would be fine and have no perceivable impact on performance.