@@ -84,29 +84,14 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
8484- (CGFloat)tableView : (UITableView *)tableView heightForRowAtIndexPath : (NSIndexPath *)indexPath
8585{
8686
87- // Dequeue a cell for the particular layout required (you will likely need to substitute
88- // the reuse identifier dynamically at runtime, instead of a static string as below).
89- // Note that this method will init and return a new cell if there isn't one available in the reuse pool,
90- // so either way after this line of code you will have a cell with the correct constraints ready to go.
91-
92- // Dequeueing a cell here works OK but you can also just hold one offscreen table view cell in a property
93- // and use it to do these height calculations. (If you have more than one cell identifier, make sure to
94- // hold a dictionary of offscreen cells, with a cell for each cell identifier in it.)
9587 RJTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: CellIdentifier];
9688
97- // Configure the cell with content for the given indexPath, for example:
98- // cell.textLabel.text = someTextForThisCell;
99- // ...
100-
10189 NSDictionary *dataSourceItem = [self .model.dataSource objectAtIndex: indexPath.row];
10290 cell.titleLabel .text = [dataSourceItem valueForKey: @" title" ];
10391 cell.bodyLabel .text = [dataSourceItem valueForKey: @" body" ];
10492
105- // The below line is VERY important for multi line labels, it tells the label when to wrap text to the next line.
106- // We have 20 pts inset on the left and right, for a total of 40 pts.
10793 cell.bodyLabel .preferredMaxLayoutWidth = tableView.bounds .size .width - (kLabelHorizontalInsets * 2 .0f );
10894
109- // Make sure the cell has constraints setup before asking it to layout
11095 [cell setNeedsUpdateConstraints ];
11196 [cell updateConstraintsIfNeeded ];
11297 [cell.contentView setNeedsLayout ];
@@ -119,9 +104,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
119104
120105- (CGFloat)tableView : (UITableView *)tableView estimatedHeightForRowAtIndexPath : (NSIndexPath *)indexPath
121106{
122- // Return a fixed constant if possible, or do some minimal calculations if needed to be able to return an
123- // estimated row height that's at least within an order of magnitude of the actual height.
124-
107+
125108 return 500 .0f ;
126109
127110}
0 commit comments