警报阻塞 Segue-iOS
Alert Blocking Segue-iOS
我想在执行 segue 之前征求用户的许可(为此我正在使用 UIAlert)。一旦他们回答了警报中的问题,我想转到下一个视图控制器,而不管他们的回答如何。
代码看起来像这样:
showAlert() //Method showing the alert
performSegue(withIdentifier : "secondVC", sender : self)
我在这里面临的问题是该应用程序向我显示警报但未执行 segue。
像这样向您的提醒关闭按钮添加一个完成处理程序
let alert = UIAlertController(title: "Alert", message: "Content Here", preferredStyle: .alert)
// add textfield or whatever you need
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { (action) in
self.performSegue(withIdentifier: "secondVC", sender: self)
}))
present(alert, animated: true)
当用户按下警报上的 "OK" 按钮时,将调用完成处理程序。
我想在执行 segue 之前征求用户的许可(为此我正在使用 UIAlert)。一旦他们回答了警报中的问题,我想转到下一个视图控制器,而不管他们的回答如何。
代码看起来像这样:
showAlert() //Method showing the alert
performSegue(withIdentifier : "secondVC", sender : self)
我在这里面临的问题是该应用程序向我显示警报但未执行 segue。
像这样向您的提醒关闭按钮添加一个完成处理程序
let alert = UIAlertController(title: "Alert", message: "Content Here", preferredStyle: .alert)
// add textfield or whatever you need
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { (action) in
self.performSegue(withIdentifier: "secondVC", sender: self)
}))
present(alert, animated: true)
当用户按下警报上的 "OK" 按钮时,将调用完成处理程序。