willDisplayHeaderView 未在 TableViewController 中调用

willDisplayHeaderView not being called in TableViewController

为什么在 TableViewController 中没有调用 willDisplayHeaderView?

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

编辑:

和heightForHeaderInSection

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

弃用?

XCODE 版本 9.0 beta 5 (9M202q)

谢谢克鲁纳尔!您的评论修复了 iOS 11(早期的 iOS 版本没有任何问题)

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

以防万一有人仍然遇到此问题,请确保您设置了 tableview 委托并实现了 UITableViewDelegate