![](/img/trans.png)
[英]Swift 4 When button is pressed a second time following an error alert it doesn't work
[英]Turning off Alert When Button Is Pressed Swift
我有使用以下代码的警报视图:
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)
}
我想在按下完成按钮时关闭此警报:
@IBAction func donePressed() {
}
在Swift中可以做到吗?
self.dismiss(animated: true, completion: nil)
我不希望您这样做,但我可以。 这里的self
是viewController。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.