UITableViewAutomaticDimension not working in Xcode 6.3

Stefan Salatic picture Stefan Salatic · Apr 10, 2015 · Viewed 11.7k times · Source

I updated my Xcode to 6.3 along with Swift 1.2, and I made the transition.

Everything works except dynamic row height for table view. I have those on 3 completely different table views, so it probably isn't something else influencing the bug.

I set all of the table views to:

tableView.rowHeight = UITableViewAutomaticDimension

and all of my xib files are properly constrained.

Any ideas?

Answer

Ken picture Ken · Apr 10, 2015

I simply added UITableViewAutomaticDimension to estimatedrowforindexpath as well. You can see how it works on the BEAM App (under 'people' category).

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return UITableViewAutomaticDimension;
}

- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return UITableViewAutomaticDimension;
}