Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)

like image 832
Wojtek Dmyszewicz Avatar asked Mar 18 '26 00:03

Wojtek Dmyszewicz


2 Answers

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;
}
like image 176
Wojtek Dmyszewicz Avatar answered Mar 19 '26 13:03

Wojtek Dmyszewicz


Just in case there is someone still having this issue, please ensure you set your tableview delegate and you implemented the UITableViewDelegate.

like image 23
knig_T Avatar answered Mar 19 '26 14:03

knig_T



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!