How to change height of grouped UITableView header?

前端 未结 10 719
野性不改
野性不改 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:10

    You can try this:

    In the loadView

    _tableView.sectionHeaderHeight = 0;
    

    Then

    -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
        return 0;
    }
    

    It should be removed as long as you do not have any objects in the header...

    And if you want some size of the sectionheader, then change only the return value.

    same if you do not get the sectionfooter removed.

    _tableView.sectionFooterHeight = 0;
    

    and

    -(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
        return 0;
    }
    

    Well, this works for my problems with the tableview in the iOS7.

提交回复
热议问题