我不确定这是否是罪魁祸首,但我对这个项目所做的最大改变是几天前升级到Swift 4.我知道我的UIAlertController消息在需要时显示多行,但今天我偶然意识到它们都变成了单行并且最后有省略号.由于我从API显示这些消息,我不能使用"\n".代码很简单;
let alert = UIAlertController(title: "Title", message: "Long message that must be shown as multiline", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { (action: UIAlertAction!) in
alert.dismiss(animated: true, completion: nil)
}))
present(alert, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)
我检查了一些其他相关的问题,但没有一个对我有效.这个问题最近被问到同样的问题,但没有得到答案,并且有一个hacky解决方案作为解决方案发布;
所有警报对话框消息和textField都已更改为单行.请检查图像
任何有关检查内容的建议都非常感谢.