gpt4 book ai didi

ios - allowsBackForwardNavigationGestures = true 在 xcode 7.1 中不起作用

转载 作者:可可西里 更新时间:2023-11-01 03:59:02 25 4
gpt4 key购买 nike

import UIKit
import WebKit

class ViewController: UIViewController, WKNavigationDelegate {

var webView : WKWebView!

override func loadView() {
webView = WKWebView()
webView.navigationDelegate = self
self.view = webView
}

override func viewDidLoad() {
super.viewDidLoad()

let url = NSURL(string: "http://boooo.com")
webView.loadRequest(NSURLRequest(URL: url!))
webView.allowsBackForwardNavigationGestures = true



}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()

}


}

一切正常,但 allowsBackForwardNavigationGestures = true 在 xcode 7.1 中不起作用。无法在 wkwebview 中后退和前进。

最佳答案

看起来它正在干扰 navigationController 的 interactivePopGestureRecognizer(如果有的话)。

    override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.navigationController?.interactivePopGestureRecognizer?.isEnabled = false
}

override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
self.navigationController?.interactivePopGestureRecognizer?.isEnabled = true
}

所以我只是在导航堆栈中使用 WKWebView 时禁用了这个属性!

关于ios - allowsBackForwardNavigationGestures = true 在 xcode 7.1 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33323881/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com