【发布时间】:2015-08-20 07:02:13
【问题描述】:
我有一个模态显示的视图控制器,当我运行 UIAlertController 时,不断收到错误消息。我该如何解决这个问题。
警报由一个按钮触发,该按钮检查文本字段是否为空。
@IBAction func registerAction(sender: AnyObject) {
if(userEmail.isEmpty){
alertMessage("Fields Are Empty")
}
}
func alertMessage(userMessage:String){
var myAlert = UIAlertController(title: "Alert", message: userMessage, preferredStyle: UIAlertControllerStyle.Alert)
let okAction = UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil)
myAlert.addAction(okAction)
self.presentViewController(myAlert, animated: true, completion: nil)
}
运行警报时出错
Warning: Attempt to present <UIAlertController: 0x7f9bbb9060d0> on <AlertApp.CustomSignupVC: 0x7f9bb94accb0> which is already presenting <UIAlertController: 0x7f9bbb926660>
【问题讨论】:
-
它没有连接到一个segue