Factorize layout of table header and footers

This commit is contained in:
ismailgulek
2020-10-07 15:26:58 +03:00
parent f032a23f0d
commit 7c89c8eaf5
2 changed files with 33 additions and 9 deletions

View File

@@ -130,16 +130,8 @@ final class RoomInfoListViewController: UIViewController {
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
let height = ceil(basicInfoView.systemLayoutSizeFitting(CGSize(width: view.bounds.width, height: 0), withHorizontalFittingPriority: .required, verticalFittingPriority: .fittingSizeLevel).height)
// compare heights to avoid infinite loop
if height != basicInfoView.frame.height {
var headerFrame = basicInfoView.frame
headerFrame.size.height = height
basicInfoView.frame = headerFrame
mainTableView.tableHeaderView = basicInfoView
}
mainTableView.vc_relayoutHeaderView()
}
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {