How to set the height of table header in UITableView?

前端 未结 17 1404
没有蜡笔的小新
没有蜡笔的小新 2020-12-02 22:00

I have gone through Apple docs about UITableView class and delegate reference but couldn\'t find the way to set the table header height explicitly.

I set Table cell

17条回答
  •  长情又很酷
    2020-12-02 22:32

    In case you still need it, have you tried to set the property

    self.tableView.tableHeaderView 
    

    If you calculate the heigh you need, and set a new view for tableHeaderView:

    CGRect frame = self.tableView.tableHeaderView.frame;
    frame.size.height = newHeight;
    
    self.tableView.tableHeaderView = [[UIView alloc] initWithFrame:frame];
    

    It should work.

提交回复
热议问题