title: My cell's resize after scrolling upwards?
body: <p>I have a problem with my TableViewCell's layout. Currently when I scroll upwards in my tableView I have found a strange and annoying bug. When I decide to release the "scroll", meaning I am dropping "the scroll" so the "View" will return to its normal position showing all of the TableView's content, some of my cell's can for some reason re-size themselves on the width. I have no clue why this occur or what the problem might be. </p>
  
  <p>All my cell's are customized to fitSize depending on the height of the label (commentLabel) in my forum. I assume the problem may be in how I am trying to customize my cell's content. I will post my relevant code and also post to pictures below.</p>
  
  <p><strong>Before starting to drag the scroll upwards</strong>: <a href="http://tinypic.com/view.php?pic=2rfsum9&amp;s=6" rel="nofollow">http://tinypic.com/view.php?pic=2rfsum9&amp;s=6</a></p>
  
  <p><strong>After release/droped the scroll again to its normal position. Now one of the cell's changed</strong>: <a href="http://tinypic.com/view.php?pic=swxnqv&amp;s=6" rel="nofollow">http://tinypic.com/view.php?pic=swxnqv&amp;s=6</a></p>
  
  <p><strong>Code</strong>:</p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)pTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
      static NSString *CellIdentifier = @"ForumthreadCell";
      UITableViewCell *cell = [pTableView dequeueReusableCellWithIdentifier:CellIdentifier];
  
      if (cell == nil)
      {
          cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
      }
  
      Feedback *item = [self.items objectAtIndex:indexPath.row];
  
      UILabel *aliasLabel = (UILabel *)[cell viewWithTag:1];
      UILabel *commentLabel = (UILabel *)[cell viewWithTag:2];
      UILabel *dateLabel = (UILabel *)[cell viewWithTag:3];
  
      [aliasLabel setText:item.alias];
      [commentLabel setText:item.comment];
      [dateLabel setText:[self.dateFormatter stringFromDate:[NSDate dateWithTimeIntervalSince1970:(double)item.time]]];
  
      commentLabel.numberOfLines = 0;
      [commentLabel sizeToFit];
      [aliasLabel sizeToFit];
      [dateLabel sizeToFit];
  
      return cell;
  }
  
  -(CGFloat)getLabelHeightForText:(NSString *)text andWidth:(CGFloat)labelWidth
  {
  
      CGSize maximumSize = CGSizeMake(labelWidth, 10000);
  
      //provide appropriate font and font size
      CGSize labelHeighSize = [text sizeWithFont: [UIFont fontWithName:@"Trebuchet MS" size:12.0f]
                           constrainedToSize:maximumSize
                               lineBreakMode:UILineBreakModeTailTruncation];
      return labelHeighSize.height;
   }
  
  - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  {
      Feedback *item = [self.items objectAtIndex:indexPath.row];
  
      CGFloat commentTextHeight = [self getLabelHeightForText:item.comment andWidth:162];
      return commentTextHeight + 39;
  }
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <pre><code>NSLog(@"bounds.origin.x: %f", commentLabel.bounds.origin.x);
  NSLog(@"bounds.origin.y: %f", commentLabel.bounds.origin.y);
  NSLog(@"bounds.size.width: %f", commentLabel.bounds.size.width);
  NSLog(@"bounds.size.height: %f", commentLabel.bounds.size.height);
  
  NSLog(@"frame.origin.x: %f", commentLabel.frame.origin.x);
  NSLog(@"frame.origin.y: %f", commentLabel.frame.origin.y);
  NSLog(@"frame.size.width: %f", commentLabel.frame.size.width);
  NSLog(@"frame.size.height: %f", commentLabel.frame.size.height);
  </code></pre>
  
  <p>resulted in this output for 1 cell (1 commentLabel output)</p>
  
  <pre><code>purgeIdleCellConnections: found one to purge conn = 0x1dd654f0
   bounds.origin.x: 0.000000
   bounds.origin.y: 0.000000
   bounds.size.width: 162.000000
   bounds.size.height: 10039.000000
   frame.origin.x: 12.000000
   frame.origin.y: 28.000000
   frame.size.width: 162.000000
   frame.size.height: 10039.000000
  </code></pre>