From 101022400789ed6f0875ae8bc1280c19ef083ded Mon Sep 17 00:00:00 2001 From: Nishant Kothary Date: Wed, 22 Oct 2014 13:59:22 -0700 Subject: [PATCH] Fix #67 --- AsyncDisplayKit/ASTableView.m | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/AsyncDisplayKit/ASTableView.m b/AsyncDisplayKit/ASTableView.m index c4a0673fb5..4502b015ba 100644 --- a/AsyncDisplayKit/ASTableView.m +++ b/AsyncDisplayKit/ASTableView.m @@ -346,21 +346,22 @@ static BOOL _isInterceptedSelector(SEL sel) - (void)rangeController:(ASRangeController *)rangeController didSizeNodesWithIndexPaths:(NSArray *)indexPaths { ASDisplayNodeAssertMainThread(); + [UIView performWithoutAnimation:^{ + [super beginUpdates]; - [super beginUpdates]; + // -insertRowsAtIndexPaths:: is insufficient; UITableView also needs to be notified of section changes + NSInteger sectionCount = [super numberOfSections]; + NSInteger newSectionCount = [_rangeController numberOfSizedSections]; + if (newSectionCount > sectionCount) { + NSRange range = NSMakeRange(sectionCount, newSectionCount - sectionCount); + NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:range]; + [super insertSections:sections withRowAnimation:UITableViewRowAnimationNone]; + } - // -insertRowsAtIndexPaths:: is insufficient; UITableView also needs to be notified of section changes - NSInteger sectionCount = [super numberOfSections]; - NSInteger newSectionCount = [_rangeController numberOfSizedSections]; - if (newSectionCount > sectionCount) { - NSRange range = NSMakeRange(sectionCount, newSectionCount - sectionCount); - NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:range]; - [super insertSections:sections withRowAnimation:UITableViewRowAnimationNone]; - } + [super insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone]; - [super insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone]; - - [super endUpdates]; + [super endUpdates]; + }]; }