iosuitableviewsectionheaderasyncdisplaykit

How to add section header/footer view when using AsyncDisplayKit?


It seems that currently ASTableNode and ASTableView both lack the support of section header/footer view.

I cannot only find a protocol method:

- (nullable NSString *)tableNode:(ASTableNode *)tableNode titleForHeaderInSection:(NSInteger)section

which shows nothing.

And the delegate/dataSource setter methods have been intercepted by AsyncDisplayKit, so that I cannot use the UIKit's way to do it.

So can I add section header/footer view when I'm using AsyncDisplayKit?


Solution

  • Just find out that ASTableNode will call the UITableViewDelegate methods.

    So just implement the methods

    - (nullable UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section;
    
    - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section;
    

    And it will work just like before.