OStack程序员社区-中国程序员成长平台

标题: ios - 什么时候navigationAction.navigationType == .linkActivated? [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 18:53
标题: ios - 什么时候navigationAction.navigationType == .linkActivated?

在 WKWebView 中,每次点击 URL 时,navigationType 都是 .othernavigationType 何时等于 .linkActivated



Best Answer-推荐答案


不太可能。也许您对原始值的解释有误?

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/






欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) Powered by Discuz! X3.4