当我尝试从tableViewDidSelect方法重新加载表视图时,我遇到了不调用委托方法的问题。
if indexPath.row == 0 {
isTermAndConditionExpanded = !isTermAndConditionExpanded
tableView.reloadData()
if isTermAndConditionExpanded {
tableView.scrollToRow(at: IndexPath(row: 1, section: indexPath.section), at: .bottom, animated: true)
} else {
tableView.scrollToRow(at: IndexPath(row: 0, section: indexPath.section), at: .bottom, animated: true)
}
基于isTermAndConditionExpanded我正在更改numberOfRowsinsection。因为它没有叫它崩溃。 我在重新加载表视图委托之前检查过,并且数据源已正确设置为呈现视图控制器