ios - How can I change the height of UITextField in UIAlertController in Swift? -


i have added uitextfield in uialertcontroller. want change height of text field. have tried way:

let alertcontroller = uialertcontroller(title: "comments", message: "write 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) 

it's not working.

this works constraint.

alertcontroller.addtextfield { textfield in     let heightconstraint = nslayoutconstraint(item: textfield, attribute: .height, relatedby: .equal, toitem: nil, attribute: .notanattribute, multiplier: 1, constant: 100)     textfield.addconstraint(heightconstraint) } 

result of adding constraint


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -