[英]Turning off Alert When Button Is Pressed Swift
I have alert view using this code: 我有使用以下代码的警报视图:
func alert() {
let alert = UIAlertController(title: "Time Is Up",
message: "Either your company has Sold or had to Fold! (Click the button below to see)",
preferredStyle: .alert)
let action = UIAlertAction(title: "Next", style: .default) { _ in
self.performSegue(withIdentifier: "congratsSegue", sender: nil)
}
alert.addAction(action)
self.present(alert, animated: true, completion: nil)
}
I want to then turn this alert off when the done button pressed: 我想在按下完成按钮时关闭此警报:
@IBAction func donePressed() {
}
Is this possible to do in Swift? 在Swift中可以做到吗?
self.dismiss(animated: true, completion: nil)
I don't think you would want to do that, but you could I suppose. 我不希望您这样做,但我可以。 self
here is the viewController. 这里的self
是viewController。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.