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

后端 未结 8 1143
南旧
南旧 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 20:40

    Single line solution:

    Objective-C

    self.tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, CGFLOAT_MIN)];
    

    Swift

    self.tableView.tableHeaderView = UIView(frame: CGRect(x: 0.0, y: 0.0, width: 0.0, height: Double(FLT_MIN)))
    

提交回复
热议问题