1
是否有创建适合屏幕宽度的自定义alertController?ios swift 3 - UIAlertController width
我试过几件事情问这个问题他们 一个是前:
let width:NSLayoutConstraint = NSLayoutConstraint(item: alertController.view, attribute: NSLayoutAttribute.width, relatedBy: NSLayoutRelation.equal, toItem: nil, attribute: NSLayoutAttribute.notAnAttribute, multiplier: 1, constant: view.bounds.width)
alertController.view.addConstraint(width)
但是这行代码总是让我alertController和屏幕之间的水平空间。
UIAlertViewController旨在通过文档使用。你最好的选择是通过UIViewController自定义视图,这样你可以根据自己的需要设置宽度以及其他配置。 – DrPatience