reloadDataを使用してセクションフッターをリフレッシュしたいのですが、最後のセクションを除いてすべてのセクションが更新されています - footerが表示されていてもviewForFooterInSectionは呼び出されません。ビューのスクロールは、最後のセクションのviewForFooterInSectionを呼び出す唯一の方法です。この行動の理由は何でしょうか?私はAutolayoutを使用しています。viewForFooterInSectionがreloadDataの最後のセクションで呼び出されていない
EDIT:heightForFooterInSectionは、異なるフッターの高さをサポートするように実装されていますが、AutomaticDimensionを返すだけで、ロジックは別の場所に移動する必要がありますか?これを使用する
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
}
にスクロールしたい場合は、ここに関連するコードを投稿してくださいことはできますか? –