Range controller: do not schedule range update after rendering finishes if already in full range mode (#3236)

This commit is contained in:
Adlai Holler
2017-04-03 09:57:16 -07:00
committed by GitHub
parent c7794a31dd
commit 42eb955d8f

View File

@@ -410,9 +410,16 @@ static UIApplicationState __ApplicationState = UIApplicationStateActive;
#pragma mark - Notification observers
/**
* If we're in a restricted range mode, but we're going to change to a full range mode soon,
* go ahead and schedule the transition as soon as all the currently-scheduled rendering is done #1163.
*/
- (void)registerForNodeDisplayNotificationsForInterfaceStateIfNeeded:(ASInterfaceState)interfaceState
{
if (!_didRegisterForNodeDisplayNotifications) {
// Do not schedule to listen if we're already in full range mode.
// This avoids updating the range controller during a collection teardown when it is removed
// from the hierarchy and its data source is cleared, causing UIKit to call -reloadData.
if (!_didRegisterForNodeDisplayNotifications && _currentRangeMode != ASLayoutRangeModeFull) {
ASLayoutRangeMode nextRangeMode = [ASRangeController rangeModeForInterfaceState:interfaceState
currentRangeMode:_currentRangeMode];
if (_currentRangeMode != nextRangeMode) {