gpt4 book ai didi

swift - 使用 UIAlertController 发出警报无法解除它

转载 作者:搜寻专家 更新时间:2023-10-31 22:55:47 25 4
gpt4 key购买 nike

我正在创建一个提醒,但当用户按下 OK 时我无法关闭它。我收到以下错误:

2017-12-28 07:03:50.301947-0400 Prestamo[691:215874] API error: <_UIKBCompatInputView: 0x10249adc0; frame = (0 0; 0 0); layer = > returned 0 width, assuming UIViewNoIntrinsicMetric

我在 Internet 上到处搜索,但找不到任何对我有帮助的东西。

   override func viewDidAppear(_ animated: Bool) {
createAlert(title: "Licencia2", message: "En el momento no tienes una licencia válida!")
}

func createAlert (title:String, message:String) {
let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: {(action) in
alert.dismiss(animated: false, completion: nil)
}))
self.present(alert, animated: false, completion: nil)
}

任何想法将不胜感激

最佳答案

您不必关闭警报 Controller 。调用 Action 处理程序后,它将自动关闭。只需删除解雇线。

let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: {(action) in

}))
self.present(alert, animated: false, completion: nil)

关于swift - 使用 UIAlertController 发出警报无法解除它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48006364/

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