Dynamic Height Table View
Mar 19, 2018
How to dynamically adjust table view height depending on its content? I got this perfect solution from this stackoverflow post. Below is the detail of the post.
Solution
Lots of the answers here don’t honor changes of the table or are way too complicated. Using a subclass of UITableView that will properly set intrinsicContentSize is a far easier solution when using autolayout. No height constraints etc. needed.
1 | class UIDynamicTableView: UITableView |
Set the class of your TableView to UIDynamicTableView in the interface builder and watch the magic as this TableView will change it’s size after a call to reloadData().
Intrinsic Content Size
So what is Intrinsic Content Size?
