From 787fd8b90b09761d56ec4016390569044644a103 Mon Sep 17 00:00:00 2001 From: Adlai Holler Date: Thu, 14 Jul 2016 11:32:50 -0700 Subject: [PATCH] [ASViewController] Defer range update conformance check until the actual range update --- AsyncDisplayKit/ASViewController.mm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/AsyncDisplayKit/ASViewController.mm b/AsyncDisplayKit/ASViewController.mm index 82d8951175..3eee5ee731 100644 --- a/AsyncDisplayKit/ASViewController.mm +++ b/AsyncDisplayKit/ASViewController.mm @@ -175,7 +175,13 @@ ASVisibilityDepthImplementation; - (void)setAutomaticallyAdjustRangeModeBasedOnViewEvents:(BOOL)automaticallyAdjustRangeModeBasedOnViewEvents { _automaticallyAdjustRangeModeBasedOnViewEvents = automaticallyAdjustRangeModeBasedOnViewEvents; - if (automaticallyAdjustRangeModeBasedOnViewEvents && !_didCheckRangeModeProtocolConformance) { +} + +- (void)updateCurrentRangeModeWithModeIfPossible:(ASLayoutRangeMode)rangeMode +{ + if (!_automaticallyAdjustRangeModeBasedOnViewEvents) { return; } + + if (!_didCheckRangeModeProtocolConformance) { _selfConformsToRangeModeProtocol = [self conformsToProtocol:@protocol(ASRangeControllerUpdateRangeProtocol)]; _nodeConformsToRangeModeProtocol = [_node conformsToProtocol:@protocol(ASRangeControllerUpdateRangeProtocol)]; _didCheckRangeModeProtocolConformance = YES; @@ -183,11 +189,6 @@ ASVisibilityDepthImplementation; NSLog(@"Warning: automaticallyAdjustRangeModeBasedOnViewEvents set to YES in %@, but range mode updating is not possible because neither view controller nor node %@ conform to ASRangeControllerUpdateRangeProtocol.", self, _node); } } -} - -- (void)updateCurrentRangeModeWithModeIfPossible:(ASLayoutRangeMode)rangeMode -{ - if (!_automaticallyAdjustRangeModeBasedOnViewEvents) { return; } if (_selfConformsToRangeModeProtocol) { id rangeUpdater = (id)self;