refreshing a tab bar item on webview

2019-06-11 14:43发布

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条回答
我欲成王,谁敢阻挡
2楼-- · 2019-06-11 14:57

You can do something like this:

override func viewWillAppear(_ animated: Bool) {

       super.viewWillAppear(animated)

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

}
查看更多
登录 后发表回答