tableView: heightForHeaderInSection: isn't called for section '0'

In Xcode 12, when I use
Code Block
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section

this method is not called for section '0'
The other UITableView protocol methods I'm using are called on section '0' properly. Strangely, only this one method among I'm using.

I don't know when this started. Since I noticed the hight of the top cell in the TableView appears short, I was trying to fix it, then found this issue. I checked our app's store version, which was built with Xcode 11 and the hight of the top cell appears properly. So, this must be new...

Anything changed?
Am I missing something?



Replies

Could you show code where you expect it to be called ?

Is it called for non zero sections ?
Thank you for your reply. But I don't understand your question of this part: "show code where you expect it to be called"

This is UITableView protocol, which means, UITableView calls this in order to create the contents when it is needed.
The inside the method will be either:
Code Block
switch(section){
case 0:
( something )
break;
default:
( something )
break;

or
Code Block
if(section == 0){
( something )
}
else if (section == 2){
( something )
}
else{
( something )
}

so that I can set different values wherever I need and returns it.

The problem I'm pointing here is, UITableView doesn't call this method to find the value for section '0' while it does call this for other sections.

By the way, I also found another weird behavior on this method.
When I set a large number for the returning value, the title of associated section will no longer appear at the bottom.
It moves up along with the value getting bigger. I believe this is a bug unless Apple changed it to this "new manner" intentionally.