title: Expanded UITableViewCell according to UILabel size
body: <p>I have a <code>UITableView</code> with 4 <code>UILabel's</code>: Title, Body, Author and Date, he looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/AVghY.png" alt="cell55"></p>
  
  <p>What I want to accomplish is, when user click on the cell itself, another label should be added to the cell, the "Body" label and the cell should expand according to this label size.</p>
  
  <p>Something like this:</p>
  
  <p><img src="https://i.stack.imgur.com/0sIjM.png" alt="cellblsize"></p>
  
  <p>How can I do that? I've searched stackoverflow, tried some code pieces, but still didn't found the right solution.</p>
  
  <p>Thanks!</p>
  
  <p>Edit 1: 14.11.12 at 14:52</p>
  
  <p>I managed to change the size of the UILabel with the current text:</p>
  
  <pre><code>- (CGRect )resizeLabelByFontSize:(UILabel *)customCellLabel withMaxHeightSize:(CGFloat )maxHeight
  {
      CGSize maximumLabelSize = CGSizeMake(239, maxHeight);
  
      CGSize expectedLabelSize = [customCellLabel.text sizeWithFont:customCellLabel.font constrainedToSize:maximumLabelSize lineBreakMode:customCellLabel.lineBreakMode];
  
      //adjust the label the the new height.
      CGRect newFrame = customCellLabel.frame;
      newFrame.size.height = expectedLabelSize.height;
  
      return newFrame;
  }
  </code></pre>
  
  <p>But how can I change the size of the cell according to the size of the new UILabel?</p>