首页 > 解决方案 > 表格视图中的分隔符(Swift)

问题描述

如何在表格视图单元格之间添加这些分隔符或空格?

或者你只是使用两个不同的细胞?

图片

标签: iosswift

解决方案


您可以添加部分页脚视图

代码:

func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
    let footerView = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.size.width, height: 50))
    return footerView
}

func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
    return 50
}

推荐阅读