let alertController = UIAlertController(title: "Hey", message: "What do you want to do?", preferredStyle: .alert)
let defaultAction = UIAlertAction(title: "OK", style: .default, handler: nil)
alertController.addAction(defaultAction)
let height:NSLayoutConstraint = NSLayoutConstraint(item: alertController.view, attribute: NSLayoutAttribute.height, relatedBy: NSLayoutRelation.equal, toItem: nil, attribute: NSLayoutAttribute.notAnAttribute, multiplier: 1, constant: 200)
alertController.view.addConstraint(height)
present(alertController, animated: true, completion: nil)
答案 0 :(得分:0)
这不是UIAlertController
的预期行为,符合documentation:
重要强>
UIAlertController类旨在按原样使用 不支持子类化。此类的视图层次结构是 私人,不得修改。