Reputation: 3219
I just put constraints into my ViewController, and I set the UITextView so that it keeps its height and width, yet at runtime it shrinks to only cover the text inside of it. How can I avoid this?
Thank you!
Upvotes: 0
Views: 67
Reputation: 1224
In my opinion, at the run time, the size of your TextView has changed because of the content, I mean the text set to it. To prevent this kind of issue, I would suggest some options which will be regarding your UI
At first, if you intend to fix size of the TextView, so from the constraints or Interface Builder, please create width and height constraints then fix the value. For example
If you wish your text view will be dynamically in size based on contents, you can set width and height values are greater than or equal a minimum value as it will not break your UI
I hope this would be helpful.
Upvotes: 1
Reputation: 692
I assume you're using Interface Builder. Check the value for Content Hugging Priority that IB set for the text view. If it's too high, it may be overriding your constraints.
Upvotes: 1