How to customise header section in static cell?

前端 未结 3 2013
[愿得一人]
[愿得一人] 2020-12-17 19:46

I want to customise the header section in my application but it\'s in static cell. I tried to make one cell to be my header by including identifier and add a new file to con

3条回答
  •  抹茶落季
    2020-12-17 20:08

    This is the easy way to do it without set a new string, just leave text in header that used in UITableview with static cell as it and add this override for header in your code

    - (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section{
        if ([view isKindOfClass:[UITableViewHeaderFooterView class]]) {
            ((UITableViewHeaderFooterView*)view).textLabel.text = [((UITableViewHeaderFooterView*)view).textLabel.text capitalizedString];
        }
    }
    

提交回复
热议问题