[ASRangeController] Ensure that visibilityDidChange: is always called on app launch for all initial cells.

This commit is contained in:
Scott Goodson
2016-03-11 17:18:32 -08:00
parent e3dde87bfd
commit cdd1bd1e39
7 changed files with 21 additions and 14 deletions

View File

@@ -91,7 +91,7 @@ static UIApplicationState __ApplicationState = UIApplicationStateActive;
_scrollDirection = scrollDirection;
// Perform update immediately, so that cells receive a visibilityDidChange: call before their first pixel is visible.
[self performRangeUpdate];
[self scheduleRangeUpdate];
}
- (void)updateCurrentRangeWithMode:(ASLayoutRangeMode)rangeMode
@@ -153,14 +153,7 @@ static UIApplicationState __ApplicationState = UIApplicationStateActive;
// allNodes is a 2D array: it contains arrays for each section, each containing nodes.
NSArray<NSArray *> *allNodes = [_dataSource completedNodes];
NSUInteger numberOfSections = [allNodes count];
if (_allPreviousIndexPaths.count == 0 && allNodes.count == 0) {
// In certain cases, such as on app suspend, an update may be triggered before we've loaded anything.
// For example, an ASCollectionNode inside another scrollable area will not load content until it has entered
// the display range, but the object may have been allocated by a cell and added to the set of active range controllers.
return;
}
// TODO: Consider if we need to use this codepath, or can rely on something more similar to the data & display ranges
// Example: ... = [_layoutController indexPathsForScrolling:_scrollDirection rangeType:ASLayoutRangeTypeVisible];
NSArray<NSIndexPath *> *visibleNodePaths = [_dataSource visibleNodeIndexPathsForRangeController:self];