0

I'm converting an existing app into AsyncDisplayKit/Texture. I just converted a UITableView to an ASTableNode, however, the UITableView relies upon viewForHeaderInSection. However, I was unable to find a delegate method in AsyncDisplayKit's ASTableDelegate.

Is there an alternative to this method? Or should I start looking for a workaround?

TheTiger
  • 13,264
  • 3
  • 57
  • 82
ilikecode
  • 391
  • 3
  • 14

1 Answers1

0

Yes, we haven't it. I'm use default UIView classes instead:

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
     static NSString *header = @"";
     UITableViewHeaderFooterView *vHeader;

     vHeader = [tableView   dequeueReusableHeaderFooterViewWithIdentifier:header];
     if (!vHeader) {
         vHeader = [[UITableViewHeaderFooterView alloc] initWithReuseIdentifier:header];
         vHeader.textLabel.backgroundColor = [UIColor clearColor];
         vHeader.textLabel.font = [UIFont fontWithName:@"HelveticaNeue" size:14];
         vHeader.textLabel.textColor = [UIColor tc_blueyGreyColor];
         vHeader.contentView.backgroundColor = [UIColor whiteColor];
     }
     vHeader.textLabel.text = [self.viewModel titleForHeaderInSection:section];
     return vHeader;
} 

But you can try call view property in ASDisplayNode too.

Nikhil Manapure
  • 3,748
  • 2
  • 30
  • 55
Bimawa
  • 3,535
  • 2
  • 25
  • 45
  • Would the implementation of `ASTableDelegate` be good here, or do you have to access the underlying `UITableView` and set a delegate on that? – ilikecode Apr 11 '18 at 10:03
  • @ilikecode yes it would be better, it's not just proxy, its have itself methods for ASTableNode. And forget about UITableVIew and it's delegates too. – Bimawa Apr 11 '18 at 11:04
  • But when I just implement `ASTableDelegate`, the `viewForHeaderInSection ` method never gets called? – ilikecode Apr 11 '18 at 11:28
  • - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section must return >0 – Bimawa Apr 11 '18 at 20:19