override 所在UIViewController的 viewDidLayoutSubviews方法
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
if let footView = tableView.tableFooterView {
//footerContentView 是footerView的內(nèi)容視圖言询,它使用自動(dòng)布局來(lái)自適應(yīng)高度嘹锁,然后在代碼里面獲取高度變更footerView 的高度
let height = footerContentView.systemLayoutSizeFittingSize(UILayoutFittingCompressedSize).height
if height != footerView.frame.height {
print("new height=\(height)")
footView.frame.size.height = height
tableView.tableFooterView = footView
}
}
}