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?
Here's another way to do it:
This is how you do it in Swift 3.0
Check the documentation for UITableView, or more specifically
-reloadSections:withRowAnimation:
You can also do it this way
I managed to do it in an indirect way: I created a UILabel and set it as section header/footer.
Does anyone know a way to do this without setting a custom footer view?
This should work: