Batch render supplementary views on reload data

This commit is contained in:
Levi McCallum
2015-09-30 13:25:39 -07:00
parent a3dce24fdc
commit 835f9e99ca
4 changed files with 61 additions and 23 deletions

View File

@@ -308,6 +308,9 @@ static void *kASSizingQueueContext = &kASSizingQueueContext;
// Measure nodes whose views are loaded before we leave the main thread
[self _layoutNodesWithMainThreadAffinity:updatedNodes atIndexPaths:updatedIndexPaths];
// Allow subclasses to perform setup before going into the edit transaction
[self prepareForReloadData];
[_editingTransactionQueue addOperationWithBlock:^{
ASLOG(@"Edit Transaction - reloadData");
@@ -319,6 +322,8 @@ static void *kASSizingQueueContext = &kASSizingQueueContext;
NSMutableIndexSet *indexSet = [[NSMutableIndexSet alloc] initWithIndexesInRange:NSMakeRange(0, _editingNodes.count)];
[self _deleteSectionsAtIndexSet:indexSet withAnimationOptions:animationOptions];
[self willReloadData];
// Insert each section
NSMutableArray *sections = [NSMutableArray arrayWithCapacity:sectionCount];
for (int i = 0; i < sectionCount; i++) {
@@ -337,6 +342,16 @@ static void *kASSizingQueueContext = &kASSizingQueueContext;
}];
}
- (void)prepareForReloadData
{
// Implemented by subclasses
}
- (void)willReloadData
{
// Implemented by subclasses
}
#pragma mark - Data Source Access (Calling _dataSource)
- (void)accessDataSourceWithBlock:(dispatch_block_t)block