let alertController = UIAlertController(Title: "Comments",message: "Write your comments here",preferredStyle: UIAlertControllerStyle.alert)alertController.addTextFIEld { (textFIEld : UITextFIEld) -> VoID in var frame: CGRect = textFIEld.frame frame.size.height = 100 textFIEld.frame = frame textFIEld.placeholder = "comment" print(textFIEld.frame.size.height)}let cancelAction = UIAlertAction(Title: "Cancel",style: UIAlertActionStyle.cancel) { (result : UIAlertAction) -> VoID in}let okAction = UIAlertAction(Title: "OK",style: UIAlertActionStyle.default) { (result : UIAlertAction) -> VoID in}alertController.addAction(cancelAction)alertController.addAction(okAction)self.present(alertController,animated: true,completion: nil)
它不起作用.
解决方法 这适用于约束.alertController.addTextFIEld { textFIEld in let heightConstraint = NSLayoutConstraint(item: textFIEld,attribute: .height,relatedBy: .equal,toItem: nil,attribute: .notAnAttribute,multiplIEr: 1,constant: 100) textFIEld.addConstraint(heightConstraint)}总结
以上是内存溢出为你收集整理的ios – 如何在Swift的UIAlertController中更改UITextField的高度?全部内容,希望文章能够帮你解决ios – 如何在Swift的UIAlertController中更改UITextField的高度?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)