I want to refresh the section footer(s) using reloadData, but right now all sections are updated except for the last one - viewForFooterInSection is not called, even if the footer is visible. Scrolling the view is the only way to call viewForFooterInSection for the last section. What could be the reason for this behavior? I'm using Autolayout.
EDIT: heightForFooterInSection is implemented to support different footer heights, but should maybe just return AutomaticDimension and the logic should go elsewhere?
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
switch(tableView) {
case self.firstTableView:
let item = self.firstItems[section]
let shouldShowFirstButton = myModel.hasActions(item)
let shouldShowSecondButton = myModel.hasOtherActions(item)
if shouldShowFirstButton && shouldShowSecondButton {
return FirstFooterView.heightForTwoButtons()
} else if shouldShowFirstButton ||shouldShowSecondButton{
return FirstFooterView.heightForOneButton()
} else {
return OtherFooterView.height()
}
case self.secondTableView:
return 0.0
case self.thirdTableView:
if self.state1 {
return 70.0
} else if selectedItem == nil {
return 0.0
}else{
return 0.0
}
default:
DDLogInfo("height 0 for section \(section)")
return 1.0
}