Improve Table Performance, Especially When Using Section Index Bar (#2506)

* Only trigger table view height requery if row-node height changed

* Make ASTableView handle the section index bar better

* Remove outdated comment

* Add a main thread assertion
This commit is contained in:
Adlai Holler
2016-10-30 09:18:13 -07:00
committed by GitHub
parent d83f058f82
commit f066efd49e
5 changed files with 144 additions and 6 deletions

View File

@@ -388,19 +388,24 @@ ASEnvironmentCollectionTableSetEnvironmentState(_environmentStateLock)
- (void)reloadDataInitiallyIfNeeded
{
ASDisplayNodeAssertMainThread();
if (!self.dataController.initialReloadDataHasBeenCalled) {
[self reloadData];
// Note: Just calling reloadData isn't enough here we need to
// ensure that _nodesConstrainedWidth is updated first.
[self.view layoutIfNeeded];
}
}
- (NSInteger)numberOfRowsInSection:(NSInteger)section
{
ASDisplayNodeAssertMainThread();
[self reloadDataInitiallyIfNeeded];
return [self.dataController numberOfRowsInSection:section];
}
- (NSInteger)numberOfSections
{
ASDisplayNodeAssertMainThread();
[self reloadDataInitiallyIfNeeded];
return [self.dataController numberOfSections];
}