I'm creating a chat based app and on the conversation thread, I am using a UIView
with a layout constraint of trailing to superview of 46px to ensure the chat bubble will be at least 46px from the right of the table view cell. Within the UIView
I have a child UITextView
which is constrained to the parent view on the top, bottom, and left. Since the text view's width can vary, I did not put a constraint on the right.
How can I get the UITextView
to wrap it's text within the bounds of the UIView
? If I don't have the clip subviews enabled on the UIView
, the longer messages overflow the view and go past the end of the table view cell. If I have the clip subviews enabled, the longer messages are just clipped and don't get wrapped.
If I use a constraint on the trailing end of the UITextView
, the width of the text view doesn't change. This makes the chat bubble much longer than the message.
Could anyone help point me in the right direction?