首页 > 解决方案 > 快速减少表格视图部分之间的差距

问题描述

我想快速缩小表格视图部分之间的差距。我试过“.leastNormalMagnitude”。但是我仍然在各个部分之间获得了一些空间。我想应该没有空间。谁能帮我?

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

        func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
            return UIView()
        }

标签: swifttableview

解决方案


要隐藏部分标题:

override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
    return nil
}


override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
    return .zero
}

推荐阅读