From ea49ada0ce84245896f78cfc9026b84df06f707c Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 11 Dec 2013 03:25:26 +0400 Subject: fix layout --- Juick/MessagesViewController.m | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'Juick') diff --git a/Juick/MessagesViewController.m b/Juick/MessagesViewController.m index 4beeb1c..92d4183 100644 --- a/Juick/MessagesViewController.m +++ b/Juick/MessagesViewController.m @@ -160,13 +160,15 @@ static NSString *CellIdentifier = @"MessageCell"; [cell bind:msg]; - cell.bodyLabel.preferredMaxLayoutWidth = tableView.bounds.size.width - (kLabelHorizontalInsets * 2.0f); - [cell setNeedsUpdateConstraints]; [cell updateConstraintsIfNeeded]; + [cell.contentView setNeedsLayout]; [cell.contentView layoutIfNeeded]; + cell.bodyLabel.preferredMaxLayoutWidth = CGRectGetWidth(cell.bodyLabel.frame); + [cell.contentView layoutIfNeeded]; + CGFloat height = [cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height; return height; @@ -174,6 +176,9 @@ static NSString *CellIdentifier = @"MessageCell"; - (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath { + if (self.dataLoading) { + return [self tableView:tableView heightForRowAtIndexPath:indexPath]; + } return 500.0f; } -- cgit v1.2.3