所以我使用UIAlertView向用户显示一些内容。内容很长,后面跟着4个按钮。由于内容的长度,整个东西不能放在屏幕上。
但是,按钮部分(在内容下面)不再是可滚动的内容,而是可滚动的,这导致其中一个按钮从一开始就被隐藏(不是很直观)。我希望内容可以滚动。

最佳答案

UIAlertView在iOS 8中被弃用。要在iOS 8及更高版本中创建和管理警报,请将UIAlertControllerpreferredStyle一起使用。如果滚动文本不适合屏幕,它也会为您提供滚动文本alert

let  alert = UIAlertController(title: YOUR_TITLE, message: YOUR_LONG_MESSAGE, preferredStyle: UIAlertControllerStyle.alert)
alert.view.tintColor = .red
alert.addAction(UIAlertAction(title: "Okay1", style: UIAlertActionStyle.default, handler: nil))
alert.addAction(UIAlertAction(title: "Okay2", style: UIAlertActionStyle.default, handler: nil))
alert.addAction(UIAlertAction(title: "Okay3", style: UIAlertActionStyle.default, handler: nil))
alert.addAction(UIAlertAction(title: "Okay4", style: UIAlertActionStyle.default, handler: nil))
self.present(alert, animated: true, completion: nil)

关于ios - UIAlertView滚动问题,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/48879650/

10-11 22:54
查看更多