ios swift 3 - UIAlertController width

老子叫甜甜 提交于 2019-12-24 01:16:23

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!