WKWebView中的刷新按钮

时间:2018-11-04 14:33:37

标签: ios swift xcode wkwebview

我正在尝试使其中一个页面的右上角显示的按钮刷新WebView。我将在代码中的什么地方添加允许发生这种情况的文本? enter image description here

    class CycleViewController: UIViewController, WKUIDelegate {

    var window: UIWindow?
    var webView: WKWebView!

    override func loadView() {
        let webConfiguration = WKWebViewConfiguration()
        webView = WKWebView(frame: .zero, configuration: webConfiguration)
        webView.uiDelegate = self
        view = webView

    }

    override func viewDidLoad() {
        super.viewDidLoad()

        webView.backgroundColor = UIColor.clear
        webView.backgroundColor = UIColor(red: 0.0196, green: 0.4, blue: 0.2902, alpha: 1.0)

        webView.isOpaque = false
        let myURL = URL(string: "https://jwelsh19.wixsite.com/countryday")
        let myRequest = URLRequest(url: myURL!)
        webView.load(myRequest)

    }
}

2 个答案:

答案 0 :(得分:1)

使用文件主故事板上的按钮将此按钮连接

@IBAction func reload(_ sender: UIButton) {

    webView.reload()

}

我希望这就是您要寻找的

答案 1 :(得分:0)

添加一个alpha*x**(-rho/(rho - 1) + 1)*(-gamma*l*rho + gamma*l - pi*gamma*rho + pi*gamma - l*rho - pi*rho)/(gamma*mu*(-rho/(rho - 1) + 1)) 作为import pandas as pd api = 'https://query1.finance.yahoo.com/v8/finance/chart/AAPL?interval=5m' df = pd.read_csv(api, skiprows=8, header=None) 的子视图,就像代码问题一样(自行调整刷新按钮框架)

UIButton