How to remove the blank space at the top of a grouped UITableView?

后端 未结 8 1089
南旧
南旧 2020-12-08 20:12

When you create a UITableView with the UITableViewStyleGrouped style, it adds quite a lot of space in between the actual tableviewcells and the bor

相关标签:
8条回答
  • 2020-12-08 21:06

    Answer in Swift 4

    If the table view is selected in interface builder and in the attributes inspector the style "Grouped" is selected, enter the following code in your view controller to fix the extra header space issue.

    func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
        return CGFloat.leastNonzeroMagnitude
    }
    
    0 讨论(0)
  • 2020-12-08 21:07
    func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
        return CGFloat.leastNonzeroMagnitude
    }
    

    Below location icon is table with top spacing zero.

    0 讨论(0)
提交回复
热议问题