Programmatically remove the header of UITableView and automatically resizes the content to fill in the removed area

前端 未结 4 1154
渐次进展
渐次进展 2020-12-17 10:32

I have added a UIButton in the header section of the UITableView via the interface builder and would like to remove the access to the button in cer

4条回答
  •  执念已碎
    2020-12-17 10:59

    You could also do:

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

    This seems to work for my (single) section header and avoids the need for reloadData.

    Note that:

    - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
    

    is still called, but its return value seems to be ignored.

提交回复
热议问题