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中做到吗?
1 个解决方案
#1
1
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。
#1
1
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。