I have a TableViewController
, and clicking on a custom cell takes you to a related WebViewController
.
The problem I'm having is that when I tap "Back" in the WebViewController
the Table View Cells in TableViewController
"jump".
Once the Table View starts scrolling they all jump back into the right heights. So I'm assuming it has something to do with heights on the TableViewController
custom cells, but I'm not totally sure.
TableViewController.m
Tried:
- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
id model = self.Model[indexPath.row];
if ([model isKindOfClass:[Two self]]) {
return 490; // As of 11/13/14
} else { // 2 other custom cells
return tableView.rowHeight; // return the default height
}
}
Also Tried:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
id model = self.Model[indexPath.row];
if ([model isKindOfClass:[One self]]) {
ListTableViewCell *cellOne = [tableView dequeueReusableCellWithIdentifier:@"1Cell"];
CGFloat heightOne = [cellOne.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height;
return heightOne + 2;
} else if ([model isKindOfClass:[Two self]]) {
ListTableViewCellTwo *cellTwo = [tableView dequeueReusableCellWithIdentifier:@"2Cell"];
CGFloat heightTwo = [cellTwo.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height;
return heightTwo + 400;
} else if ([model isKindOfClass:[Three self]]) {
ListTableViewCellThree *cellThree = [tableView dequeueReusableCellWithIdentifier:@"3Cell"];
CGFloat heightThree = [cellThree.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height;
return heightThree + 2;
} else {
return 300;
}
}
UPDATE:
Also tried [cell setNeedsUpdateConstraints];
and [cell setNeedsLayout];
.
Also have tried setting estimatedHeight
multiple different spots, and also added Automatic Row Dimension
in tandem with that.
Help would be appreciated! Will post any extra info needed. Thanks!
I'm only supporting iOS 8. I'm using Auto Layout and Storyboards.
Additional Storyboard info for Custom Cell 2:
Storyboard Constraints: