fix inserting sections bug

This commit is contained in:
Li Tan
2014-12-18 13:04:02 -08:00
parent 4886d3d1ad
commit 3e6436245d
5 changed files with 40 additions and 13 deletions

View File

@@ -53,9 +53,17 @@ static const CGFloat kASFlowLayoutControllerRefreshingThreshold = 0.3;
}];
}
- (void)insertSectionsAtIndexSet:(NSIndexSet *)indexSet {
- (void)insertSections:(NSArray *)sections atIndexSet:(NSIndexSet *)indexSet {
__block int cnt = 0;
[indexSet enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) {
_nodeSizes.insert(_nodeSizes.begin() + idx, std::vector<CGSize>());
NSArray *nodes = sections[cnt++];
std::vector<CGSize> v(nodes.count);
for (int i = 0; i < nodes.count; i++) {
v.push_back([nodes[i] CGSizeValue]);
}
_nodeSizes.insert(_nodeSizes.begin() + idx, v);
}];
}