【发布时间】:2016-12-13 10:08:55
【问题描述】:
在我的 UITableView 中有自定义页脚视图:
public func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { // custom view for footer. will be adjusted to default or specified footer height
return footer()
}
func footer() -> UILabel {
let label = UILabel(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.size.width, height: (navigationController?.navigationBar.bounds.size.height)!))
label.backgroundColor = AppColors.Bordo.color
label.font = UIFont.boldSystemFont(ofSize: 16)
label.textColor = .white
label.text = "Selected \(self.selectedGenres.count) of \(self.genres.count)"
label.textAlignment = .center
return label
}
当用户在表格视图中选择/取消选择行时,我想用所选行的信息刷新页脚。如何在不重新加载整个 tableview 的情况下做到这一点? UITableView的footerView(forSection: indexPath.section)是做什么的?
【问题讨论】:
-
只需致电
reloadSections
标签: swift uitableview