I have a UITableViewController that displays properties of an NSManagedObject in a grouped tableView. The values of those properties can be changed from custom UITableViewCell subclasses that have UISteppers and UITextFields. The table normally has 9 sections, but when some of the NSManagedObject's properties are nil, I hide those sections by setting numberOfRowsInSection to 0, as well as heightForHeaderInSection and heightForFooterInSection to 1. That works fine; the sections are hidden.
The custom cells call a delegate method that changes the NSManagedObject's property values, and the UITableViewController is set up to KVO observe the properties of the NSManagedObject, and reload its individual rows when the corresponding properties change. Here's the beginning of the method:
#define POSITION 3
#define TARGETED_BY 5
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if ([keyPath isEqualToString:@"positionX"]) {
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:0 inSection:POSITION]]
withRowAnimation:UITableViewRowAnimationNone];
} else if ([keyPath isEqualToString:@"positionY"]) {
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:1 inSection:POSITION]]
withRowAnimation:UITableViewRowAnimationNone];
} else if ([keyPath isEqualToString:@"isTargetedBy"]) {
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:TARGETED_BY]
withRowAnimation:UITableViewRowAnimationNone];
}
}
It's not the complete method with all the properties, but you get the idea.
THE PROBLEM: when I've hidden the section above PROPERTIES, and I change the value of positionX, the cell at row 0 (the correct positionX cell) reloads not with UITableViewRowAnimationNone, but with what appears to be UITableViewRowAnimationFade. It moves, and I don't want it to. My subclass is directly from UITableViewController, and there's no other method in the class that reloads any rows or sections with anything other than -RowAnimationNone. And when I try to reload the whole section with no animation, the whole section animates. None of the other rows in the section behave like this; they reload correctly, with no animation. And row 0 reloads with no animation when the section above it is not hidden.
I can work around this by calling [self.tableview reloadData], but I'd rather not do it that way, for the sake of time and hackiness. Anyone have any idea how to prevent this behavior?