2015-10-24 27 views
6
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() 

} 


} 

Mọi thứ hoạt động tốt nhưng cho phépBackForwardNavigationGestures = true không hoạt động trong xcode 7.1. không thể quay lại và chuyển tiếp trong wkwebview.allowBackForwardNavigationGestures = true không hoạt động trong xcode 7.1

Trả lời

0

Có vẻ như nó đang can thiệp vào điều hướng tương tácPopGestureRecognizer (nếu bạn có).

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 
} 

Vì vậy, tôi chỉ vô hiệu hóa tài sản này tại thời điểm sử dụng WKWebView trong việc điều khiển chồng!

Các vấn đề liên quan