我希望我的 UIWebView 在出现负载中断或干扰时显示警告 View 错误消息,我已尝试实现以下代码,但未成功:
func webView(webView: UIWebView, didFailLoadWithError error: NSError?) {
let myAlert = UIAlertController(title: "Alert", message: error?.localizedDescription, preferredStyle: UIAlertControllerStyle.Alert)
myAlert.showViewController(myAlert, sender: self)
}
此方法是否存在无效问题?如果是,我应该如何更正?
最佳答案
替换:myAlert.showViewController(myAlert, sender: self)
有了这个:self.presentViewController(myAlert, animated: true, completion: nil)
关于ios - 如何正确实现 UIWebView 'didFailLoadWithError' 警报 View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32703033/