1

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:

enter image description here

And this second screen, and this is with a conversation, overlapping each other, without a limit when passed from a cell to another.

enter image description here

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?

2
  • It would help us to help you if we had your code to work with. The solution is easier with auto layout, but if you have some code that calculates cells size and want to use it instead - add it to the question so the the others could try to find the issue there.
    – A-Live
    Commented Jan 11, 2016 at 15:49
  • @A-Live added code in question Commented Jan 11, 2016 at 16:04

0

Browse other questions tagged or ask your own question.