How to change UIAlertController height?
I found you can add constraints before you present the view controller
let alertController = UIAlertController(title: nil, message: "hello", preferredStyle: .alert)
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel) { (action) in
// hide action sheet
}
alertController.addAction(cancelAction)
var height:NSLayoutConstraint = NSLayoutConstraint(
item: alertController.view, attribute: NSLayoutConstraint.Attribute.height,
relatedBy: NSLayoutConstraint.Relation.equal, toItem: nil,
attribute: NSLayoutConstraint.Attribute.notAnAttribute,
multiplier: 1, constant: self.view.frame.height * 0.80)
alertController.view.addConstraint(height);
self.present(alertController, animated: true, completion: nil)
Since I did not have a message to input I added lines with "\n \n \n" in the message field to make the alert controller height longer.