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

ios – allowsBackForwardNavigationGestures = true在xcode 7.1中不起作用,第1张

概述import UIKitimport WebKitclass ViewController: UIViewController, WKNavigationDelegate {var webView : WKWebView!override func loadView() { webView = WKWebView() webView.navigationDelegat
import UIKitimport WebKitclass 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()}}

一切正常,但allowBackForwardNavigationGestures = 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中不起作用全部内容,希望文章能够帮你解决ios – allowsBackForwardNavigationGestures = true在xcode 7.1中不起作用所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1054318.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-25
下一篇2022-05-25

发表评论

登录后才能评论

评论列表(0条)

    保存