ios - 什么时候navigationAction.navigationType == .linkActivated?
<p><p>在 WKWebView 中,每次点击 URL 时,<code>navigationType</code> 都是 <code>.other</code>。 <code>navigationType</code> 何时等于 <code>.linkActivated</code>?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>不太可能。也许您对原始值的解释有误?</p>
<pre><code>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
}
</code></pre>
<p>见 <a href="https://developer.apple.com/documentation/webkit/wknavigationtype" rel="noreferrer noopener nofollow">the docs</a>您可以在其中单击列出的枚举并查看它们的原始值</p></p>
<p style="font-size: 20px;">关于ios - 什么时候navigationAction.navigationType == .linkActivated?,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/46548202/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/46548202/
</a>
</p>
页:
[1]