How to use UITableViewHeaderFooterView?

后端 未结 9 2058
傲寒
傲寒 2020-12-23 02:12

Hi I want to use UITableHeaderFooterView in my app and i am doing this:

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional          


        
9条回答
  •  猫巷女王i
    2020-12-23 02:50

    In case it gets lost in the thorough answers above, the thing that people are likely missing (compared to the standard cellForRowAtIndexPath: method) is that you must register the class used for the section header.

    [tableView registerClass:[UITableViewHeaderFooterView class] forHeaderFooterViewReuseIdentifier:@"SectionHeader"];
    

    Try adding registerClass:forHeaderFooterViewReuseIdentifier: and see if it starts working.

提交回复
热议问题