title: Increase the main tableview row height according to the custom cell
body: <p>I am having an app in which I have a <strong>Tableview</strong> and on that tableview's each row I am dynamically creating a custom tableview cell.</p>
  
  <p>Below is the code for that.</p>
  
  <pre><code>NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"flowviewTableViewCell" owner:self options:nil];
  
  cell2 = [nib objectAtIndex:0];
  
  return cell2;
  </code></pre>
  
  <p>"FlowTableViewCell" is a UITableViewCell. <strong>In this custom cell, I have one tableview.</strong></p>
  
  <p>I am showing some data on my custom tableview cell from an array and those data varies in length. It is not fixed. </p>
  
  <p><strong>I am able to increase the custom cell size but not the main tableview row height depending upon the size of custom tableview cell.</strong></p>
  
  <p><strong>I want to increase the height of the main tableview's cell size dynamically depending upon the size of custom tableview cell.</strong></p>
  
  <p>With the following code, the height of the custom tableView cell is increasing.</p>
  
  <pre><code>- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  {
  
      NSString *str = [arrComments objectAtIndex:indexPath.row];
      CGSize size = [str sizeWithFont:[UIFont fontWithName:@"Helvetica" size:14] constrainedToSize:CGSizeMake(280, 999) lineBreakMode:NSLineBreakByWordWrapping];
      NSLog(@"%f",size.height);
      if (size.height&lt;20)
  
      {
          size.height=20;
          //m= size.height;
  
      }
  
      NSLog(@"%f",size.height);
  
      return size.height +  30;
  
  
  }
  </code></pre>
  
  <p>How can I adjust the height of main tableview's row height depending on the size of custom tableviewcell?</p>
  
  <p>Here,I am attaching some of the screenshots for clear understanding.</p>
  
  <p>The following is my custom TableViewCell:</p>
  
  <p><img src="https://i.stack.imgur.com/tLR1G.png" alt="Custom TableViewCell"></p>
  
  <p>The following is my main TableView : </p>
  
  <p><img src="https://i.stack.imgur.com/qx195.png" alt="Main TableView"></p>
  
  <p>Following is the output I am getting right now:</p>
  
  <p><img src="https://i.stack.imgur.com/Jrelc.png" alt="output getting right now"></p>
  
  <p>You can see in the above image that comment2 gets cut and comment3 of the same post gets displayed in the next post.</p>
  
  <p>I want output like  following Image.</p>
  
  <p><img src="https://i.stack.imgur.com/yyv8o.png" alt="enter image description here"></p>
  
  <p><strong>So,my question is how can I increase the height of the main tableview's cell size dynamically depending upon the size of custom tableview cell?</strong></p>
  
  <p>Please help me.any help will be appreciated</p>