I have an UITextView that loads different text depending on the route the user has taken in order to get to the view with the text on it.
How do I dynamically adjust the height of the UITextView depending on its content using Swift?
I have an UITextView that loads different text depending on the route the user has taken in order to get to the view with the text on it.
How do I dynamically adjust the height of the UITextView depending on its content using Swift?
Copyright © 2021 Jogjafile Inc.
Setup your constraints so that the edges are pinned but allow the text view to grow vertically. Then set a height constraint (the value doesn't matter here). Create an
@IBOutletfor theUITextViewand the height constraint. Then we can dynamically change the height in code: