在WKWebView中,每次我点击一个URL时,navigationType就是.othernavigationType什么时候等于.linkActivated

最佳答案

不太可能。也许您将原始值解释为错误?

func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
    print(navigationAction.navigationType.rawValue)
    // -1 "other" seen when assigning the url programatically
    // 0 "linkActivated" a link with an href attribute was tapped
    // 3 "reload" page was refreshed
}

查看the docs,您可以在其中单击列出的枚举,并查看其原始值

关于ios - navigationAction.navigationType什么时候== .linkActivated?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/46548202/

10-10 21:47