How to change height of grouped UITableView header?

前端 未结 10 727
野性不改
野性不改 2020-12-07 09:22

I know how to change the height of the section headers in the table view. But I am unable to find any solution to change the default spacing before the first section.

10条回答
  •  感动是毒
    2020-12-07 10:25

    It appears that I can't set a table header view with height of 0. I ended up doing the following:

    - (void)viewWillAppear:(BOOL)animated{
        CGRect frame = self.tableView.tableHeaderView.frame;
        frame.size.height = 1;
        UIView *headerView = [[UIView alloc] initWithFrame:frame];
        [self.tableView setTableHeaderView:headerView];
    }
    

提交回复
热议问题