I have UITableView
with 2 cells that do AutoLayout (quite simple, UILabel
and UISwitch
, and UILabel
and UIImageView
). I want to get tableView heihgt
. UITableView
reside to UIView
, so i did following:
override func layoutSubviews() {
super.layoutSubviews()
if !isLayoutSubviewsDone {
expectedHeight = tableView.contentSize.height
isLayoutSubviewsDone = true
didLayoutSubivews?()
}
}
unfortunately, tableView.contentSize.height
is smaller that it should be. for about 20%. How to get exact height amount?