UITextView with dynamic width

In my storyboard I have a UITextView pinned to the top and bottom safe areas of its view, and with a constraint that centres it. The various text files it will be displaying have lines of different lengths (e.g. some are poetry, others are prose), so I'd like the text view to adjust its width dynamically in response to its content.


I've found some stuff online that shows how to do this for dynamic height, but I can't find anything that shows how to set constraints for dynamic width. Can this be done in a storyboard at all?

Replies

Hi!


You wanna make the width adjust with'n the text inside the UITextField or you wanna the UITextField adjust the witdh with'n a screen?

A lot of information and hints here:

https://stackoverflow.com/questions/50467/how-do-i-size-a-uitextview-to-its-content