Permalink
Browse files

Fixed increasing the cell height everytime you reload

  • Loading branch information...
1 parent 927dcc7 commit e6bd17f80f124bcc93688bd9227ad2f1ed4d6717 @dlinsin dlinsin committed Oct 7, 2012
Showing with 7 additions and 9 deletions.
  1. +7 −9 Example/TentStatusExample/TimelineViewController.m
@@ -92,15 +92,13 @@ - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
- // TODO: Fix this
- StatusPostCell *cell = [tableView dequeueReusableCellWithIdentifier:@"StatusPostCell"];
- StatusPost *statusPost = (StatusPost *)[self.statusArray objectAtIndex:indexPath.row];
- cell.statusLabel.text = statusPost.status;
- CGFloat cellHeight = cell.frame.size.height;
- CGFloat labelHeight = 19.f;
- CGFloat adjustedlabelHeight = [cell.statusLabel sizeThatFits:CGSizeMake(280.f, CGFLOAT_MAX)].height;
- CGFloat adjustedCellHeight = cellHeight + (adjustedlabelHeight - labelHeight);
- return adjustedCellHeight;
+
+ NSString *cellText = ((StatusPost *)[self.statusArray objectAtIndex:indexPath.row]).status;
+ UIFont *cellFont = [UIFont fontWithName:@"Helvetica Neue" size:14.0f];
+ CGSize constraintSize = CGSizeMake(280.0f, MAXFLOAT);
+ CGSize labelSize = [cellText sizeWithFont:cellFont constrainedToSize:constraintSize lineBreakMode:NSLineBreakByTruncatingTail];
+
+ return labelSize.height + 86.0f;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

0 comments on commit e6bd17f

Please sign in to comment.