This question already has an answer here:
-
Wrong value from UITableView:rowHeight at iOS8
6 answers
I have a UITableView
in Xcode in my project and I set rowHeight
to be 44
in StoryBoard
.
In iOS7 everything is fine but in iOS8 rowHeight returns a value of -1 which cause my table view not being displayed.
In iOS 8, Apple introduces a new feature for UITableView known as Self Sizing Cells.
If you want to display dynamic content in table view with variable height, you would need to calculate the row height manually.
tableView.estimatedRowHeight = 44.0
tableView.rowHeight = UITableViewAutomaticDimension
Here is demo http://www.appcoda.com/self-sizing-cells/