Is there any way to reload the section header/footer of a table view without calling [tableView reloadData];
?
In fact, I want to show the number of cells in a table view's section in its section footer. The table view is editable and I delete or insert rows using
– insertRowsAtIndexPaths:withRowAnimation: – deleteRowsAtIndexPaths:withRowAnimation:
It seems that these methods do not update the section footer. Strangely, when I call these methods the table view data-source method
- (NSString *)tableView:(UITableView *)table titleForFooterInSection:(NSInteger)section
is called (twice!) but it does not update the table view with the new values!!
Anyone has any idea how to fix this problem?
If you just have a basic text header or footer, you can access them directly:
[tableView footerViewForSection:indexPath.section].textLabel.text = [self tableView:tableView titleForFooterInSection:indexPath.section];
similarly for the header:
[tableView headerViewForSection:indexPath.section].textLabel.text = [self tableView:tableView titleForHeaderInSection:indexPath.section];
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