gpt4 book ai didi

ios - 按下按钮时关闭警报 Swift

转载 作者:行者123 更新时间:2023-11-28 15:23:36 24 4
gpt4 key购买 nike

我有使用此代码的警报 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com