I occasionally have a section of my UITableView where there are no cells contained in that section. In that case then, there are two headers on top of each other since there are no cells in the upper section. I'm trying to figure out how I can temporarily hide that upper header and then have it reappear when I come back to the page later.
Can I return zero for -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
and then force it to be called again in viewWillAppear somehow??
Also, if I reload the data using [self.tableView reloadData]
, how do you just return the standard height for a UITableView Header?
When you have to hide header
[tableView setContentOffset:CGPointMake(0, 44) animated:YES];
When you have to show header
[tableView setContentOffset:CGPointMake(0, 0) animated:YES];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With