class alert {
func msg(message: String, title: String = "")
{
let alertView = UIAlertController(title: title, message: message, preferredStyle: .Alert)
alertView.addAction(UIAlertAction(title: "Done", style: .Default, handler: nil))
UIApplication.sharedApplication().keyWindow?.rootViewController?.presentViewController(alertView, animated: true, completion: nil)
}
}
我在stackoverflow中找到了这个代码,并尝试使用Xcode 7.但它在presentviewcontroller上显示错误,错误读取“无法调用非函数类型的值'UIViewController'?”。我输错了什么?
感谢