我有一个简单的WebKitView问题。我只在IB中设置WebKitView以显示在屏幕的底部3/4部分,但是在加载网站时占据整个页面。任何想法为什么会这样?
另外我还有另外一个问题,为什么WebView不赞成使用WebKitView比WebView更好?是否加载速度更快等?
感谢您的回复。
import UIKit
import WebKit
class ViewController: UIViewController {
@IBOutlet var webView: WKWebView!
override func loadView() {
webView = WKWebView()
//If you want to implement the delegate
//webView?.navigationDelegate = self
view = webView
}
override func viewDidLoad() {
super.viewDidLoad()
if let url = URL(string: "https://www.google.ca") {
let req = URLRequest(url: url)
webView?.load(req)
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}