UITableView: Header below a section gets duplicated if a row is deleted from the section above
Posted
by Megasaur
on Stack Overflow
See other posts from Stack Overflow
or by Megasaur
Published on 2009-11-04T13:43:51Z
Indexed on
2010/04/13
9:52 UTC
Read the original article
Hit count: 468
In the editing mode of one of my tableviews, I delete a row from a section. The section below has a header. The deletion of the row in the section above leads to duplication of the section header below. So I have 2 header titles, one above the other.
I also tried forcing a reload of the section after the delete to no avail:
[self.tableView beginUpdates];
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES];
NSIndexSet * indexSet = [[NSIndexSet alloc] initWithIndexesInRange:NSMakeRange(3,1)];
[self.tableView reloadSections:indexSet withRowAnimation:UITableViewRowAnimationFade];
[indexSet release];
[self.tableView endUpdates];
Any ideas of what I have done wrong?
It is also interesting that the header that failed to get removed is not "seen". If I scroll right off the content of the table view, and let it snap back, only the top header view is seen. It always ignores the header that should have been removed.
© Stack Overflow or respective owner