mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-21 19:42:59 +08:00
Skip handling individual change notifications if we're using a sortSelector and just reload the table afterwards
This commit is contained in:
committed by
Blake Watters
parent
8670b233e0
commit
983b7913a2
@@ -511,6 +511,9 @@
|
||||
|
||||
- (void)controllerWillChangeContent:(NSFetchedResultsController*)controller {
|
||||
RKLogTrace(@"Beginning updates for fetchedResultsController (%@). Current section count = %d (resource path: %@)", controller, [[controller sections] count], _resourcePath);
|
||||
|
||||
if(_sortSelector) return;
|
||||
|
||||
[self.tableView beginUpdates];
|
||||
_isEmptyBeforeAnimation = [self isEmpty];
|
||||
}
|
||||
@@ -520,7 +523,9 @@
|
||||
atIndex:(NSUInteger)sectionIndex
|
||||
forChangeType:(NSFetchedResultsChangeType)type {
|
||||
|
||||
switch (type) {
|
||||
if(_sortSelector) return;
|
||||
|
||||
switch (type) {
|
||||
case NSFetchedResultsChangeInsert:
|
||||
[self.tableView insertSections:[NSIndexSet indexSetWithIndex:sectionIndex]
|
||||
withRowAnimation:UITableViewRowAnimationFade];
|
||||
@@ -543,6 +548,8 @@
|
||||
forChangeType:(NSFetchedResultsChangeType)type
|
||||
newIndexPath:(NSIndexPath *)newIndexPath {
|
||||
|
||||
if(_sortSelector) return;
|
||||
|
||||
NSIndexPath* adjIndexPath = [self indexPathForFetchedResultsIndexPath:indexPath];
|
||||
NSIndexPath* adjNewIndexPath = [self indexPathForFetchedResultsIndexPath:newIndexPath];
|
||||
|
||||
@@ -585,8 +592,15 @@
|
||||
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:[self emptyItemIndexPath]]
|
||||
withRowAnimation:UITableViewRowAnimationFade];
|
||||
}
|
||||
|
||||
[self updateSortedArray];
|
||||
[self.tableView endUpdates];
|
||||
|
||||
if(_sortSelector) {
|
||||
[self.tableView reloadData];
|
||||
} else {
|
||||
[self.tableView endUpdates];
|
||||
}
|
||||
|
||||
[self didFinishLoad];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user