I have a problem with a chat functionality that I'm trying to implement.
Each row is a custom cell. The custom cell is initialized from xib file and has an UIView, and inside it there is a UITextview
and a UIButton
.
The problem: I always have the same width in my rows (cells) and I want them to adapt to the content. The height is ok (I use "heightForRowAtIndexPath").
I tried setting the frame in the cellForRowAtIndexPath
with the following:
cell.message.frame = CGRectMake(cell.message.frame.origin.x, cell.message.frame.origin.y, MyNewRect.size.height, MyNewRect.size.height);
(By the way: cell.message is the UITextView)
I searched in other StackOverflow Questions but nothing really helped me. Maybe the problem is the container but I don't know how to resize both of them.