Dynamic UITextView Heighgt With Auto Layout
Jul 20, 2018
If you are using pure auto layout to setup user interface, you might experience some issue when setup dynamic height for UITextView or UITextField.
Here is how you can setup dynamic height using pure auto layout.
Auto Layout Setup
First, make sure that you have disable the scrolling for the UITextView or UITextField
1 | textView.isScrollEnabled = false |
Then create the constraints, and have a property which is the view’s height constraints. Now when you assign text, below is the code use to update the height constraint.
1 | textView.text = text |
