Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show section header of UITableView even when it's empty

Tags:

ios

iphone

I'd like to show the section header of my table view even when there is no object in my section.

None of these methods are called for my empty section:

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section;
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section;

EDIT : I found the answer.

I was sending 0 to numberOfSectionsInTableView when I got no object that's why thoses methods wasn't call.

So even when a section is empty, my header is shown

like image 364
booker Avatar asked Jan 16 '23 22:01

booker


1 Answers

I found the answer.

I was sending 0 to numberOfSectionsInTableView when I got no object that's why thoses methods wasn't call.

So even when a section is empty, my header is shown

like image 95
booker Avatar answered Jan 28 '23 05:01

booker