you can create the web view programatically as simple as possible use this piece of code
override func viewDidLoad() {
super.viewDidLoad()
let webV:UIWebView = UIWebView(frame: CGRectMake(0, 0, UIScreen.mainScreen().bounds.width, UIScreen.mainScreen().bounds.height))
webV.loadRequest(NSURLRequest(URL: NSURL(string: "http://www.google.co.in")))
webV.delegate = self;
self.view.addSubview(webV)
}
and if you want use this delegate function
func webView(webView: UIWebView!, didFailLoadWithError error: NSError!) {
? ? print("Webview fail with error (error)");
}
func webView(webView: UIWebView!, shouldStartLoadWithRequest request: NSURLRequest!, navigationType: UIWebViewNavigationType) -> Bool {
? ? return true;
}
func webViewDidStartLoad(webView: UIWebView!) {
? ? print("Webview started Loading")
}
func webViewDidFinishLoad(webView: UIWebView!) {
? ? print("Webview did finish load")
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…