Go into full range mode if a scroll happens

This commit is contained in:
Michael Schneider
2016-03-12 15:44:27 -08:00
parent fe8cc9328c
commit e4ddb7e270
4 changed files with 24 additions and 1 deletions

View File

@@ -61,11 +61,16 @@ static UIApplicationState __ApplicationState = UIApplicationStateActive;
#pragma mark - Core visible node range managment API
+ (BOOL)isFirstRangeUpdateForRangeMode:(ASLayoutRangeMode)rangeMode
{
return (rangeMode == ASLayoutRangeModeInvalid);
}
+ (ASLayoutRangeMode)rangeModeForInterfaceState:(ASInterfaceState)interfaceState
currentRangeMode:(ASLayoutRangeMode)currentRangeMode
{
BOOL isVisible = (ASInterfaceStateIncludesVisible(interfaceState));
BOOL isFirstRangeUpdate = (currentRangeMode == ASLayoutRangeModeInvalid);
BOOL isFirstRangeUpdate = [self isFirstRangeUpdateForRangeMode:currentRangeMode];
if (!isVisible || isFirstRangeUpdate) {
return ASLayoutRangeModeMinimum;
}
@@ -94,6 +99,15 @@ static UIApplicationState __ApplicationState = UIApplicationStateActive;
[self scheduleRangeUpdate];
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
// If a scroll happenes the current range mode needs to go to full
BOOL isFirstRangeUpdate = [[self class] isFirstRangeUpdateForRangeMode:_currentRangeMode];
if (!isFirstRangeUpdate && _currentRangeMode != ASLayoutRangeModeFull) {
[self scheduleRangeUpdate];
}
}
- (void)updateCurrentRangeWithMode:(ASLayoutRangeMode)rangeMode
{
if (_currentRangeMode != rangeMode) {