I have added a UIButton in the header section of the UITableView via the interface builder and would like to remove the access to the button in cer
I created a boolean property called removeHeader and then when ever I want to remove my header I call:
func removeSectionHeader() {
removeHeader = true
self.tableView.reloadData()
}
Then when my tableView reloads it will call this tableView delegate method:
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
if removeHeader {
return 0.0
} else {
let height = self.tableView.sectionHeaderHeight
return height
}
}