Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 8.3 breaks automatic cell height

Tags:

ios

ios8

ios8.3

Long time reader, first time poster.

I use automatic cell height with auto layout in my app. In iOS 8.3 and 8.4, this appears to be broken. I have a sample project. When built in 8.2 or lower, it works properly. The cell heights are determined by Autolayout. When built in 8.3 or 8.4 it doesn't work. I have searched online and I don't see anyone posting about this issue.

Take a look at the screenshots below. Any help is appreciated.

Cell Height Project ZIP

Screenshot comparison http://jeffburg.com/skitch/CellHeightProjectComparison.png

Thanks! -Jeff

like image 368
Jeffrey Bergier Avatar asked Mar 11 '26 21:03

Jeffrey Bergier


2 Answers

I checked your code and found the problem.

Reading through AppCodas article about self-sizing cells, it looks like you should use estimatedRowHeight when using UITableViewAutomaticDimension (haven't used it myself, cannot confirm). So either remove the following line:

self.tableView.rowHeight = UITableViewAutomaticDimension

or add (if your cell height will be changing based on content):

self.tableView.estimatedRowHeight = 122;
like image 62
Gasim Avatar answered Mar 14 '26 11:03

Gasim


I used to have the same issue on my iOS >8.3 project. I fixed your sample project by implementing the delegate methods instead of setting the rowHeight in viewDidLoad. This is definitely a bug related to UITableView, so you did nothing wrong.

like image 41
t0day Avatar answered Mar 14 '26 10:03

t0day



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!