title: UIButton: calculate height of UIButton based on titleLabel Text
body: <p>I have a custom UIButton in a custom UITableViewCell. I want to set the height of the UIButton in the custom table cell based on the variable textual content of the titleLabel of the button. </p>
  
  <p>I tried the following method to calculate the height </p>
  
  <pre><code>[NSString sizeWithFont:constrainedToSize:lineBreakMode:];
  </code></pre>
  
  <p>but I could not successfully change the button height as per the titleLabel.</p>
  
  <p>Further, as this button is part of a custom UITableViewCell, I also need to change the height of the cell as per the height of the custom UIButton. </p>
  
  <p>In the ViewController implementing the delegate and the datasource methods of the UITableView, I tried to determine the height in the following method</p>
  
  <pre><code>- (CGFloat) tableView: (UITableView *) tableView 
  heightForRowAtIndexPath:(NSIndexPath *)indexPath
  </code></pre>
  
  <p>but was not successful.</p>
  
  <p>What could be the best solution or approach to solve this?</p>