How can we change the font of tableview header?

前端 未结 5 998
灰色年华
灰色年华 2021-01-30 07:51

I am using some background color for the tabelView and style is grouped. The text in the header for the sections is not clear so I need to modify the the text color so that the

5条回答
  •  既然无缘
    2021-01-30 08:22

    - (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section {
    
    if ([view isKindOfClass:[UITableViewHeaderFooterView class]]) {
        UITableViewHeaderFooterView *headerView = (UITableViewHeaderFooterView*)view;
        [headerView.textLabel setFont:[UIFont fontWithName:@"Gotham Book" size:16.0f]];
    }}
    

    We can use header.textlabel object to change other "UILabel" properties for that label.

提交回复
热议问题