Search code examples
iosobjective-cuitableviewios11

willDisplayHeaderView not being called in TableViewController


Why is willDisplayHeaderView not being called in TableViewController?

- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(nonnull UIView *)view forSection:(NSInteger)section
{
  //
}

Edit:

And heightForHeaderInSection

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
  //
}

Deprecation?

XCODE Version 9.0 beta 5 (9M202q)


Solution

  • Thanks Krunal! Your comment fixed it for iOS 11 (earlier iOS versions didn't have any problems)

    - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
    {
      return myView;
    }