Reputation: 207
I want to change the textField height as the user types in it. How can I do it?
I don't want to use a TextView
.
Upvotes: 1
Views: 361
Reputation: 172
Every UITextField
comes with an action Editing changed, you can drag and drop as an action to your class.
In this method, you can probably change the constraint that defines the height of the UITextField
. Make sure to call self.view.layoutIfNeeded()
to update the constraint you just changed. For example:
@IBAction func editingChanged(sender: AnyObject) {
editTextHeight.constant += 2.0
self.view.layoutIfNeeded()
}
Upvotes: 4