我正在创建警报,但当用户按“确定”时无法将其关闭。我收到以下错误:
2017-12-28 07:03:50.301947-0400 Prestamo[691:215874] API 错误:
<_uikbcompatinputview> 返回 0 宽度,假设
UIViewNoIntrinsicMetric
我在互联网上到处搜索,但找不到任何对我有帮助的东西。
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)
}
任何想法,将不胜感激
您不必关闭警报控制器。调用操作处理程序后它将自动关闭。只需删除解雇线即可。
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)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)