I would like to get the size of a UITableView\'s content view when the table is populated. Any suggestions on how to do this?
I don't know how much people will like this answer because I am not sure that I like it. But I managed to get something working with this.
This will work for dynamic height cells. The callback will get called a few times as the tableview figures out its contentView
class ContentSizeNotifyingTableView: UITableView {
var contentSizeDidChange: ((CGSize) -> ())?
override var contentSize: CGSize {
didSet {
self.contentSizeDidChange?(self.contentSize)
}
}
}