1
我想使显示了信息的提示对话框,这是我在ViewController.swift代码:无法调用非函数类型“UIViewController?”的值
func showErrorAlert(title: String , msg: String){
let alert = UIAlertController(title: title, message: msg, preferredStyle: .Alert)
let action = UIAlertAction(title: "OK", style: .Default, handler: nil)
alert.addAction(action)
presentedViewController(alert, animated: true, completion: nil)
}
最后一行是给我的错误:
"Cannot call value of non-function type "UIViewController?""
更改为self.present(警报,动画:假的,完成:无)也解决了这个问题。 – eyal
'presentViewController'给了我同样的错误,只有'self.present'工作 – Antek