I was following this tutorial to make self sizing cells.
I registered custom cell into table view and in the cell xib I gave every subview constraints manually. Please refer to the source code in GitHub
Arranging 3 labels vertically in one cell's content view worked fine in iOS 9 but not in iOS 8 (both tested in device and simulator).
In iOS 8 one cell does not have fitting height and not every label shows all it's full text.
iOS 8 not fitting:
iOS 9 as I expected:
Any advice would be appreciated!
Update
code in viewDidLoad
:
tableView.registerNib(UINib.init(nibName: "SelfSizingCell", bundle: nil), forCellReuseIdentifier: cellIdentifier)
tableView.dataSource = self
tableView.delegate = self
tableView.estimatedRowHeight = 60.0
tableView.rowHeight = UITableViewAutomaticDimension
tableView.reloadData()
add following code in "cellForRowAtIndexPath" method before return cell.
cell.setNeedsUpdateConstraints()
cell.updateConstraintsIfNeeded()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With