I am creating a chat to iOS in Objective-C, and use custom UITableViewCell
. My difficulty is to resize the Cell as text in chat, as the picture:
And this second screen, and this is with a conversation, overlapping each other, without a limit when passed from a cell to another.
Already tried to use from AutoLayout, and did not work well. To resize the background of the Cell, which is like a UILabel, we used the code:
-(void)resizeLabel:(NSString *)textString labelResize:(UILabel *)labelResize{
CGSize maximumLabelSize = CGSizeMake(296, FLT_MAX);
CGSize expectedLabelSize = [textString sizeWithFont:labelResize.font constrainedToSize:maximumLabelSize lineBreakMode:labelResize.lineBreakMode];
//adjust the label the the new height.
CGRect newFrame = labelResize.frame;
newFrame.size.height = expectedLabelSize.height;
labelResize.frame = newFrame;}
I did not use any code to resize the UITableViewCell itself because it was not getting.
Could you help me?