Section header font change in iOS 11

Viewed 658

I am noticing this issue on the UITableViews with default section header titles. Some of titles appear in the smaller font (as in iOS 10) while the other section header titles appear in a larger bolder font. Only func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? has been implemented for showing the titles. A workaround can be to use viewForHeaderInSectionwith a custom label, but I was wondering is there any other way to fix this.

1 Answers

I had the same problem as you. As a workaround, I use the following:

- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section {
    UITableViewHeaderFooterView *tableViewHeaderFooterView = (UITableViewHeaderFooterView *)view;
    tableViewHeaderFooterView.textLabel.font = [UIFont fontWithName:@"Montserrat-Bold" size:15];
}

Reference: https://forums.developer.apple.com/thread/86379

Related