title: How to get cell in heightForRowAtIndexPath?
body: <p>I have created custom cells in my app.I want to get the each cell in <code>HeightForRowAtIndexPath</code>.Please tell me how can i get the custom cell in this method.I have tried this code but this causes infinite loop &amp; finally crash the app.</p>
  
  <pre><code>HomeCell *cell=(HomeCell *)[tableView cellForRowAtIndexPath:indexPath];
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I Have tried this but it gives me cell height as zero.</p>
  
  <pre><code>-   (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  {
  
      static NSString *cellIdentifier = @"HomeCell";
      HomeCell *cell = (HomeCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
  
      float tv_view_height=cell.tv_post.frame.size.height;
      float like_count_height=cell.label_like_count.frame.size.height;
      float first_comment_height=cell.first_comment.frame.size.height;
      float second_comment_height=cell.second_cmment.frame.size.height;
      float third_comment_height=cell.third_comment.frame.size.height;
  
      Post *user_post=[arr_post objectAtIndex:indexPath.row];
      float comment_count=[user_post.comment_count intValue];
      if(comment_count&lt;=0)
      {
          first_comment_height=0;
          second_comment_height=0;
          third_comment_height=0;
  
  
      }
      else if(comment_count==1)
      {
          second_comment_height=0;
          third_comment_height=0;
  
      }
      else if(comment_count==2)
      {
  
          third_comment_height=0;
      }
       float like_count=[user_post.like_count intValue];
      if(like_count&lt;=0)
      {
  
          like_count_height=0;
      }
      float total_height=tv_view_height+like_count_height+first_comment_height+second_comment_height+third_comment_height;
      NSLog(@"total heigh is %f'",total_height);
      return total_height;
  }
  </code></pre>
  
  <p>Please tell which is the best way?</p>