I understand that for iOS UIWebView
I can implement UIWebViewDelegate
and then access the method required.
However for a custom browser SVWebViewController, I am confused as to how to implement the delegate method as I tried implementing UIWebViewDelegate
above and it did not work (The "load" message is not showing at all).
class TableInfo: UITableViewController, MWFeedParserDelegate, ENSideMenuDelegate,UIWebViewDelegate{
var allowLoad = true
func webView(webView: UIWebView, shouldStartLoadWithRequest request: NSURLRequest, navigationType: UIWebViewNavigationType) -> Bool {
println("Load")
return allowLoad
}
func webViewDidFinishLoad(webView: UIWebView) {
allowLoad = false
}
}
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
if hasInternet {
let item = self.items[indexPath.row] as MWFeedItem
let URL = NSURL(string: item.link)
let con = SVWebViewController(URL: URL)
self.navigationController?.pushViewController(con, animated: true)
}
}