title: Dynamic table cell height (content cut off)
body: <p>I'm trying to create a table view with cells that have dynamic heights, everything seemed to work fine, but then I noticed this strange problem.
  When I scroll the list down and go back up, some of the cells appear to not fully draw the content.</p>
  
  <p>Correct content: <a href="https://www.dropbox.com/s/eqsx4p6dmsofrko/Screen%20Shot%202012-05-03%20at%2010.30.11%20AM.png" rel="nofollow">https://www.dropbox.com/s/eqsx4p6dmsofrko/Screen%20Shot%202012-05-03%20at%2010.30.11%20AM.png</a></p>
  
  <p>Content cut of: <a href="https://www.dropbox.com/s/qqelftkc5jzetk5/Screen%20Shot%202012-05-03%20at%2010.30.19%20AM.png" rel="nofollow">https://www.dropbox.com/s/qqelftkc5jzetk5/Screen%20Shot%202012-05-03%20at%2010.30.19%20AM.png</a></p>
  
  <p>I create all my cells here:</p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
      static NSString *CellIdentifier = @"ItemCell";
      ItemCell *cell = (ItemCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
      Item *item = [self.activity objectAtIndex:indexPath.row];
      cell.projectLabel.text = item.project;
      cell.descriptionLabel.text = item.description;
      cell.timeLabel.text = item.time;
      cell.timeAgoLabel.text = item.timeAgo;
      //cell.avatar = [UIImageView item.avatar];
  
      cell.descriptionLabel.numberOfLines = 0;
      [cell.descriptionLabel sizeToFit];
  
      // remove the right arrow
      cell.accessoryType = UITableViewCellAccessoryNone;
  
      //[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:0 inSection:0]] withRowAnimation: UITableViewRowAnimationNone];
  
      return cell;
  }
  </code></pre>
  
  <p>And use this to change the height of the cells:</p>
  
  <pre><code>- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  {
      static NSString *CellIdentifier = @"ItemCell";
      ItemCell *cell = (ItemCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  
      CGSize descriptionHeight = [cell.descriptionLabel.text sizeWithFont:[UIFont boldSystemFontOfSize:18.0f] constrainedToSize:CGSizeMake(265.0f, CGFLOAT_MAX) lineBreakMode:UILineBreakModeWordWrap];
  
      NSInteger height = cell.projectLabel.frame.origin.y + cell.projectLabel.frame.size.height;
      height += descriptionHeight.height + 30;
  
      NSLog(@"height: %d", height);
  
      return height;
  }
  </code></pre>