We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6512f1f commit de57a1aCopy full SHA for de57a1a
1 file changed
TableViewCellWithAutoLayout/TableViewController/RJTableViewController.m
@@ -147,6 +147,13 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
147
148
// Make sure the constraints have been added to this cell, since it may have just been created from scratch
149
[cell setNeedsUpdateConstraints];
150
+ [cell updateConstraintsIfNeeded];
151
+
152
+ // Since we have multi-line labels, do an initial layout pass and then set the preferredMaxLayoutWidth
153
+ // based on their width so they will wrap text and take on the correct height
154
+ [cell.contentView setNeedsLayout];
155
+ [cell.contentView layoutIfNeeded];
156
+ cell.bodyLabel.preferredMaxLayoutWidth = CGRectGetWidth(cell.bodyLabel.frame);
157
158
return cell;
159
}
0 commit comments