Troubles with changing the font size in UITableViewHeaderFooterView

前端 未结 4 628
萌比男神i
萌比男神i 2020-12-16 12:16

Here is the problem,

I subclass a UITableViewHeaderFooterView and want to change the font size:

- (id)initWithFrame:(CGRect)frame
{
    self = [super         


        
4条回答
  •  离开以前
    2020-12-16 12:33

    You could implement tableView:willDisplayHeaderView and change the font in kind of this way:

    - (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section {
        if(section == ...)
        {
            UITableViewHeaderFooterView *headerView = (UITableViewHeaderFooterView *)view;
            NSAttributedString *headerText = ... ;
            headerView.textLabel.attributedText = headerText;
        }
    }
    

提交回复
热议问题