我有使用此代码的警报 View :
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。
关于ios - 按下按钮时关闭警报 Swift,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45575012/