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

If you want to remove the table's header view, just set the myTable.tableHeaderView property to nil. If what you have is actually a section header, then you need to return nil from the viewForHeaderInSection method and call [myTableView reloadData]


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.