Swift 为什么';我的警报视图控制器不能工作吗
如果我构建此警报,则不会显示警报视图。我错过了什么Swift 为什么';我的警报视图控制器不能工作吗,swift,uialertview,Swift,Uialertview,如果我构建此警报,则不会显示警报视图。我错过了什么 另外,我知道还有一些类似的问题,但要找出它们有什么,我错过了什么是很难的您必须在视图中显示Alert视图 let alert = UIAlertController(title: "Title", message: "message", preferredStyle: UIAlertControllerStyle.alert) alert.addAction(UIAlertAction(title: "Cancel", style: UIAle
另外,我知道还有一些类似的问题,但要找出它们有什么,我错过了什么是很难的您必须在视图中显示Alert视图
let alert = UIAlertController(title: "Title", message: "message", preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.cancel, handler: nil))
alert.addAction(UIAlertAction(title: "Title", style: UIAlertActionStyle.default, handler: { action in self.alertFunc() }))
您必须在视图上显示Alert视图
let alert = UIAlertController(title: "Title", message: "message", preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.cancel, handler: nil))
alert.addAction(UIAlertAction(title: "Title", style: UIAlertActionStyle.default, handler: { action in self.alertFunc() }))
您也需要在当前的上下文中演示它:
self.present(alert, animated: true, completion: nil)
将该行添加到警报
声明的末尾:
self.present(alert, animated: true, completion: nil)
您也需要在当前的上下文中演示它:
self.present(alert, animated: true, completion: nil)
将该行添加到警报
声明的末尾:
self.present(alert, animated: true, completion: nil)