Merci à une réponse sur GitHub de @ tapis-Claassen
code
- (void)viewDidLoad {
[[self tableView] registerClass:[UITableViewHeaderFooterView class] forHeaderFooterViewReuseIdentifier:@"headerFooterReuseIdentifier"];
}
tête
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UITableViewHeaderFooterView *headerFooterView = [[self tableView] dequeueReusableHeaderFooterViewWithIdentifier:@"headerFooterReuseIdentifier"];
headerFooterView.contentView.backgroundColor = kBackgroundColor;
return headerFooterView;
}
Pied de page
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
UITableViewHeaderFooterView *headerFooterView = [[self tableView] dequeueReusableHeaderFooterViewWithIdentifier:@"headerFooterReuseIdentifier"];
headerFooterView.contentView.backgroundColor = kBackgroundColor;
return headerFooterView;
}