![](/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.