[英]iOS Swift: Adding bottom insets between section in Table View
如果表格是普通类型,我想在一个部分的最后一个单元格和下一个部分的标题之间添加一些空间
我怎样才能做到这一点?
你可以试试
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 20
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView()
}
您可以使用页脚视图
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView()
}
为避免页脚发粘,请使用allowFooterViewsToFloat()函数
public extension UITableView {
func allowsHeaderViewsToFloat() -> Bool {
return true
}
func allowsFooterViewsToFloat() -> Bool {
return false
}
}
您只需在本节末尾添加空白单元格即可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.