refreshing a tab bar item on webview

僤鯓⒐⒋嵵緔 提交于 2019-12-08 11:19:29

问题


I am newbie and need help. I built a webview app on xcode (swift), with tab bars. and I need to know, how can I refresh the tab bar, when I pressed it.

how can I refresh my tab bar item, when I pressed first tab bar item? For example, twitter app. when you pressed first tab, it refreshes the wiew, and goes to main screen.

here is my code;

override func viewDidLoad() {
         super.viewDidLoad()
let url = URL (string: "https://google.com")
        let webviewgo = URLRequest(url: url!)
        firstWebview.loadRequest(webviewgo)
}

回答1:


You can do something like this:

override func viewWillAppear(_ animated: Bool) {

       super.viewWillAppear(animated)

       self. firstWebview.loadRequest(URLRequest(url: URL(string: "https://google.com")!))

}


来源:https://stackoverflow.com/questions/42448746/refreshing-a-tab-bar-item-on-webview

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