Improvements for automatic range mode

- Only update range mode if visibility changes if the node is not range controlled
- Only change explicitly set range mode if ASRangeController becomes visible
- Return interface state for range controller in ASCollectionView and ASTableView based on if the containing node is range managed
This commit is contained in:
Michael Schneider
2016-03-15 13:38:46 -07:00
parent b30fa8b2f6
commit d3ba80ccfd
6 changed files with 59 additions and 25 deletions

View File

@@ -189,7 +189,9 @@ static UIApplicationState __ApplicationState = UIApplicationStateActive;
ASInterfaceState selfInterfaceState = [self interfaceState];
ASLayoutRangeMode rangeMode = _currentRangeMode;
if (!_didUpdateCurrentRange) {
// 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)) {
rangeMode = [ASRangeController rangeModeForInterfaceState:selfInterfaceState currentRangeMode:_currentRangeMode];
}
@@ -232,7 +234,10 @@ static UIApplicationState __ApplicationState = UIApplicationStateActive;
_allPreviousIndexPaths = allCurrentIndexPaths;
_currentRangeMode = rangeMode;
_didUpdateCurrentRange = NO;
// Reset the current range mode only if the range controller comes visible
if (ASInterfaceStateIncludesVisible(selfInterfaceState)) {
_didUpdateCurrentRange = NO;
}
if (!_rangeIsValid) {
[allIndexPaths addObjectsFromArray:ASIndexPathsForTwoDimensionalArray(allNodes)];