mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
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:
@@ -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];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user