mirror of
https://github.com/Instagram/IGListKit
synced 2026-05-23 17:28:22 +00:00
create emptyViewForListAdapter only when needed
Summary: We don't need to create the `emptyViewForListAdapter` if it's hidden Reviewed By: patters Differential Revision: D23429238 fbshipit-source-id: 8d85964c177f53a0e0cc0867339c1cbf0db2ee4e
This commit is contained in:
parent
0693ca6be5
commit
29d4640997
1 changed files with 11 additions and 7 deletions
|
|
@ -791,14 +791,18 @@
|
|||
if (self.isInUpdateBlock) {
|
||||
return; // will be called again when update block completes
|
||||
}
|
||||
UIView *backgroundView = [self.dataSource emptyViewForListAdapter:self];
|
||||
// don't do anything if the client is using the same view
|
||||
if (backgroundView != _collectionView.backgroundView) {
|
||||
// collection view will just stack the background views underneath each other if we do not remove the previous
|
||||
// one first. also fine if it is nil
|
||||
[_collectionView.backgroundView removeFromSuperview];
|
||||
_collectionView.backgroundView = backgroundView;
|
||||
|
||||
if (!shouldHide || !_experimentalUpdater) {
|
||||
UIView *backgroundView = [self.dataSource emptyViewForListAdapter:self];
|
||||
// don't do anything if the client is using the same view
|
||||
if (backgroundView != _collectionView.backgroundView) {
|
||||
// collection view will just stack the background views underneath each other if we do not remove the previous
|
||||
// one first. also fine if it is nil
|
||||
[_collectionView.backgroundView removeFromSuperview];
|
||||
_collectionView.backgroundView = backgroundView;
|
||||
}
|
||||
}
|
||||
|
||||
_collectionView.backgroundView.hidden = shouldHide;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue