Я могу добавить WKWebView программно в подвью с кодом ниже. Как добавить WKWebView в контейнер viewView2, который был добавлен через Interface Builder?
import UIKit
import WebKit
class ViewController: UIViewController {
@IBOutlet var containerView : UIView?
@IBOutlet weak var containerView2: UIView!
var webView: WKWebView?
override func loadView() {
super.loadView()
self.webView = WKWebView()
self.webView?.frame = CGRectMake(50, 50, 200, 200)
self.webView?.sizeToFit()
self.containerView = self.webView!
//how can I set a View (containerView2) added by Interface Builder = to self.webView!
self.view.addSubview(self.containerView!)
}
override func viewDidLoad() {
super.viewDidLoad()
var url = NSURL(string:"http://www.google.com")
var req = NSURLRequest(URL:url)
self.webView!.loadRequest(req)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}