I know that to set the height of regular textfield programatically by using this code
textField.frame.size.height = 60
But if I implement this code to textfield inside my UIAlertController
, it doesn't work. I also try to change the keyboard to ASCII capable, but it doesn't change the keyboard after I run the app. it seems I miss something
Here is the code of my alert controller
let alertController = UIAlertController(title: "Write Comment", message: "Tell us why you are not satisfied", preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: "Send", style: .default, handler: { alert -> Void in
let textField = alertController.textFields![0] as UITextField
textField.frame.size.height = 60
textField.keyboardType = .asciiCapable
let commentDefect = textField.text ?? ""
self.sendComment(defectID: defectID, comment: commentDefect)
}))
alertController.view.tintColor = UIColor(red: 0/255, green: 129/255, blue: 58/255, alpha: 1)
alertController.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
alertController.addTextField(configurationHandler: {(textField : UITextField!) -> Void in
textField.placeholder = ""
})
self.present(alertController, animated: true, completion: nil)
It seems the height is still around 17. What went wrong here?