, .
, view * height of row. , 30, 4 ,
tableHeight = 4*30 = 120
, tableview . , tableview, . , .
. , , tableview collectionview .
. ( ) .
:
tableViewHieghtConstraint.constant = tableHeight
collectionViewHieghtConstraint.constant = tableHeight
tableView , , .
, . , .
func reloadData() {
self.tableView.reloadData()
let tableHeight: CGFloat = 0
DispatchQueue.main.asyncAfter(deadline: .now()+0.3) {
for i in 0...aryData.count - 1 {
let frame = self.tableView.rectForRow(at: IndexPath(row: i, section: 0))
tableHeight += frame.size.height
print(frame.size.height)
}
}
tableViewHieghtConstraint.constant = tableHeight
collectionViewHieghtConstraint.constant = tableHeight
}
. , , .
P.S: contentview.