【发布时间】:2018-07-03 12:47:55
【问题描述】:
我正在开发 IOS 应用程序,我一直在使用 Web 服务获取和发送数据。有时我需要显示消息,例如带有详细信息的错误消息。所以我一直在使用以下消息向用户显示警报。这是完美的
let alertController = UIAlertController(title: ""+title, message: ""+msg, preferredStyle: UIAlertControllerStyle.alert)
alertController.addAction(UIAlertAction(title: ""+txtBtnPositive, style: UIAlertActionStyle.default, handler: { (action: UIAlertAction!) in
if(shouldExitScreen){
self.navigationController!.popViewController(animated: true)
self.dismiss(animated: true, completion: nil)
}
}))
self.present(alertController, animated: true, completion: nil)
这是一个运行良好的代码 sn-p。如果消息很长,则长消息将显示在多行上。单行消息没有问题。
但突然间,UiAlertController 在一行中显示长消息,并从尾部截断。但是我没有更改代码。我不知道为什么会这样。有什么提示吗?
【问题讨论】:
-
只是调试您的代码可能是您调用 API 两次并动态更改消息。 UiAlertController 不能那样做。
-
不,即使我在一个按钮上使用此代码,它也会在单击时向用户显示此消息“此功能在免费版本中尚不可用,但很快就会可用。谢谢”我正在显示此消息,并且我没有更改消息和 Ui 警报代码,并且此静态消息也出现在单行中。不知道是什么问题?
-
UILabel'snumberOfLines包含在UIAlertController中时使用代理设置的任何机会 -
哪个 UILabel ?
-
我也有同样的问题,我的 alertController 被截断了。怎么能像正常人一样。