I have a UITableView
with a filter button. If the button is pressed, it may happen, that the table is empty. To inform the user, I am adding a tableheader view in that case. If there are rows to show, I set the header back to nil.
Update: I am not talking about section header, I am talking about the table header.
Everything works as expected, but if the tableheader is removed, I see a gap over the table, that hasn't been there before. Any idea how to get rid if it?
This is the code:
if( _sections.count == 0 ) {
UIView *tableHeader = [self getTableHeader]; // make a view
self.tableView.tableHeaderView = tableHeader;
}
else {
self.tableView.tableHeaderView = nil;
[self.tableView reloadData]; // I added this as a test - no luck
}
This is how it looks before filtering everything away:
This is the "empty" case:
This is, if I remove the filter again: