title: Unable to set cell size according to label's text size in objective-c
body: <p>I am trying for chat app. Chat working fine. Facing some UI issues. </p>
  
  <p><strong>1.</strong> I am using auto layout for label. So automatically label get expand according to the message size. But, I am having label in UITableViewCell. I couldn't calculate row height dynamically.</p>
  
  <p>My Code:</p>
  
  <pre><code>-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  CGSize textSize = {268, CGFLOAT_MAX};
  CGSize size = [message sizeWithFont:[UIFont fontWithName:@"Helvetica Neue" size:14] constrainedToSize:textSize lineBreakMode:NSLineBreakByWordWrapping];
  CGFloat height = size.height  &lt; 65 ? 65 : size.height;
  return height;
  }
  </code></pre>
  
  <p><strong>My Label Sub class Code</strong></p>
  
  <pre><code>- (void)drawTextInRect:(CGRect)rect
  {
      self.textInsets = UIEdgeInsetsMake(5, 5, 5, 5);
      return [super drawTextInRect:UIEdgeInsetsInsetRect(rect, self.textInsets)];
  }
  
  - (CGSize) intrinsicContentSize
  {
      self.textInsets = UIEdgeInsetsMake(5, 5, 5, 5);
      CGSize superSize = [super intrinsicContentSize] ;
      superSize.height += self.textInsets.top + self.textInsets.bottom ;
      superSize.width += self.textInsets.left + self.textInsets.right ;
      return superSize ;
  }
  </code></pre>
  
  <p>The above code working for small messages, like 400 to 800 characters. More than that it is not working. Cell size not getting increase, as per label size. Kindly guide me.</p>
  
  <p><strong>My Output:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/Y7hJM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Y7hJM.png" alt="enter image description here"></a></p>
  
  <p>In the above screenshot, small messages displaying time and full message. If we type large text, 20% of message getting hide. kindly guide me. How to solve this?</p>