问题
Is there anyway to create a custom alertController that fit the width of the screen ?
I tried several things before asking this question one of them is :
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)
But this line of code always makes a horizontal space between my alertController and the Screen.
回答1:
Here is what I currently find in the Apple documents:
Appearance of Alert Views: You cannot customize the appearance of alert views.
This disappoints me as I think the message text in alert views is too small for many users. DrPatience, in a comment above, suggests a possible workaround. Alert Views
来源:https://stackoverflow.com/questions/40933616/ios-swift-3-uialertcontroller-width