diff --git a/AsyncDisplayKit/Details/ASRangeController.mm b/AsyncDisplayKit/Details/ASRangeController.mm index 761a74a606..b990831cb0 100644 --- a/AsyncDisplayKit/Details/ASRangeController.mm +++ b/AsyncDisplayKit/Details/ASRangeController.mm @@ -63,7 +63,7 @@ static UIApplicationState __ApplicationState = UIApplicationStateActive; + (BOOL)isFirstRangeUpdateForRangeMode:(ASLayoutRangeMode)rangeMode { - return (rangeMode == ASLayoutRangeModeInvalid); + return (rangeMode == ASLayoutRangeModeInvalid); } + (ASLayoutRangeMode)rangeModeForInterfaceState:(ASInterfaceState)interfaceState @@ -191,7 +191,7 @@ static UIApplicationState __ApplicationState = UIApplicationStateActive; ASLayoutRangeMode rangeMode = _currentRangeMode; // If the range mode is explicitly set via updateCurrentRangeWithMode: it will last in that mode until the // range controller becomes visible again or explicitly changes the range mode again - if (!_didUpdateCurrentRange || ASInterfaceStateIncludesVisible(selfInterfaceState)) { + if (!_didUpdateCurrentRange && ASInterfaceStateIncludesVisible(selfInterfaceState)) { rangeMode = [ASRangeController rangeModeForInterfaceState:selfInterfaceState currentRangeMode:_currentRangeMode]; } @@ -234,10 +234,7 @@ static UIApplicationState __ApplicationState = UIApplicationStateActive; _allPreviousIndexPaths = allCurrentIndexPaths; _currentRangeMode = rangeMode; - // Reset the current range mode only if the range controller comes visible - if (ASInterfaceStateIncludesVisible(selfInterfaceState)) { - _didUpdateCurrentRange = NO; - } + _didUpdateCurrentRange = NO; if (!_rangeIsValid) { [allIndexPaths addObjectsFromArray:ASIndexPathsForTwoDimensionalArray(allNodes)]; diff --git a/AsyncDisplayKit/Details/ASRangeControllerUpdateRangeProtocol+Beta.h b/AsyncDisplayKit/Details/ASRangeControllerUpdateRangeProtocol+Beta.h index 99c054ed21..bf7e1dfbbe 100644 --- a/AsyncDisplayKit/Details/ASRangeControllerUpdateRangeProtocol+Beta.h +++ b/AsyncDisplayKit/Details/ASRangeControllerUpdateRangeProtocol+Beta.h @@ -13,18 +13,20 @@ #import "ASTableNode.h" /** - * Update the range mode for a range controller to a specific range mode until the node that contains the range + * Update the range mode for a range controller to a explicitly set range mode until the node that contains the range * controller becomes visible again * * Logic for the automatic range mode: - * 1. If there are no visible node paths available nothing is to be done and no range update is done - * 2. The initial range update always will be ASLayoutRangeModeCount (ASLayoutRangeModeMinimum) as it's the initial fetch - * 3. If the range mode is explicitly set via updateCurrentRangeWithMode: it will last in that mode until the range controller becomes visible and a new range update was triggered or a new range mode via updateCurrentRangeWithMode: is set + * 1. If there are no visible node paths available nothing is to be done and no range update will happen + * 2. The initial range update if the range controller is visible always will be ASLayoutRangeModeCount + * (ASLayoutRangeModeMinimum) as it's the initial fetch + * 3. The range mode set explicitly via updateCurrentRangeWithMode: will last at least one range update. After that it + the range controller will use the explicit set range mode until it becomes visible and a new range update was + triggered or a new range mode via updateCurrentRangeWithMode: is set * 4. If range mode is not explicitly set the range mode is variying based if the range controller is visible or not */ - @protocol ASRangeControllerUpdateRangeProtocol /**