我在UITableView上实现了可扩展部分,现在我的问题是,当UIViewController加载表时,该部分下面有行。
未展开:
展开:
如果该部分未展开,我希望UITableView
没有行,因此我可以在该部分下方设置另一个UIView
。展开该部分后,UIView
应该消失,表格视图将显示在整个屏幕上。
答案 0 :(得分:1)
只需实现viewForFooterInSection
并返回一个空视图。
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView(frame: .zero)
}
答案 1 :(得分:1)
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView()
}
只需使用此代码,它将删除您不需要的行。