From ed4f7eff73c387099f67d276c7a081630899b5f2 Mon Sep 17 00:00:00 2001 From: Michael Schneider Date: Fri, 18 Nov 2016 11:35:45 -0800 Subject: [PATCH] Force layout pass in `ASViewController` `viewWillAppear:` to trigger automatic subnode management A measure as well as layout pass is forced this early to get nodes like ASCollectionNode, ASTableNode etc. into the hierarchy before UIKit applies the scroll view inset adjustments, if automatic subnode management is enabled. Otherwise the insets would not be applied. --- AsyncDisplayKit/ASViewController.mm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/AsyncDisplayKit/ASViewController.mm b/AsyncDisplayKit/ASViewController.mm index dfb41bfc7f..606f667c10 100644 --- a/AsyncDisplayKit/ASViewController.mm +++ b/AsyncDisplayKit/ASViewController.mm @@ -135,10 +135,11 @@ ASVisibilityDidMoveToParentViewController; [super viewWillAppear:animated]; _ensureDisplayed = YES; - // We do this early layout because we need to get any ASCollectionNodes etc. into the - // hierarchy before UIKit applies the scroll view inset adjustments, if you are using - // automatic subnode management. + // A measure as well as layout pass is forced this early to get nodes like ASCollectionNode, ASTableNode etc. + // into the hierarchy before UIKit applies the scroll view inset adjustments, if automatic subnode management + // is enabled. Otherwise the insets would not be applied. [_node layoutThatFits:[self nodeConstrainedSize]]; + [_node.view layoutIfNeeded]; [_node recursivelyFetchData];