Since we have prototype cells, you can also add a prototype cell to your table. Fill in the prototype cell ID in Interface Builder. (e.g. HeaderCell) Then you can use it in viewForHeaderForSection, as you use cells in cellForRowAtIndexPath.
Example:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { UIView *headerView = [tableView dequeueReusableCellWithIdentifier:HeaderCellID]; UILabel *label = (UILabel *)[headerView viewWithTag:100]; label.text = [self tableView:self.tableView titleForHeaderInSection:section]; return headerView; }
source share