Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITableview reload SectionHeader but not cells in section

I have a tableview where I want to reload (and change the height of) just the sectionHeader but not the cells inside this section. The reason I want to do this is because I use the fade animation on the header, like so:

[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0]   
    withRowAnimation:UITableViewRowAnimationFade];

But at the same time I am adding a cell in that section with

[self.tableView insertRowsAtIndexPaths:
    @[[NSIndexPath indexPathForRow:0 inSection:0]]
    withRowAnimation:UITableViewRowAnimationRight];

I'd like to be able to keep the UITableViewRowAnimationRight for the cell that is being added, but when I reload the Section, the fade animation gets applied to the whole section. Is there any way to just reload the sectionHeader, and not the cells in the section?

like image 928
Kyle Rosenbluth Avatar asked Aug 18 '13 19:08

Kyle Rosenbluth


1 Answers

Just create 2 separate brackets of

[tableView beginUpdates];
[tableView endUpdates];

for the two insertions / changes.

like image 110
Mundi Avatar answered Oct 28 '22 04:10

Mundi