diff --git a/AsyncDisplayKit/ASDisplayNode.h b/AsyncDisplayKit/ASDisplayNode.h
index dddc908239..bbc1453a84 100644
--- a/AsyncDisplayKit/ASDisplayNode.h
+++ b/AsyncDisplayKit/ASDisplayNode.h
@@ -254,6 +254,8 @@ extern NSInteger const ASDefaultDrawingPriority;
/** @name Managing dimensions */
+- (CGSize)sizeThatFits:(CGSize)size;
+
/**
* @abstract Asks the node to return a layout based on given size range.
*
diff --git a/AsyncDisplayKit/ASDisplayNode.mm b/AsyncDisplayKit/ASDisplayNode.mm
index ef05ff6a04..f1cb9daacf 100644
--- a/AsyncDisplayKit/ASDisplayNode.mm
+++ b/AsyncDisplayKit/ASDisplayNode.mm
@@ -703,6 +703,11 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
#pragma mark - Layout
+- (CGSize)sizeThatFits:(CGSize)size
+{
+ return [self layoutThatFits:ASSizeRangeMake(CGSizeZero, size)].size;
+}
+
- (ASLayout *)layoutThatFits:(ASSizeRange)constrainedSize
{
#pragma clang diagnostic push
@@ -1495,15 +1500,11 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
// If no measure pass happened or the bounds changed between layout passes we manually trigger a measurement pass
// for the node using a size range equal to whatever bounds were provided to the node
- if (hasDirtyLayout) {
- if (CGRectEqualToRect(bounds, CGRectZero)) {
- LOG(@"Warning: No size given for node before node was trying to layout itself: %@. Please provide a frame for the node.", self);
- } else {
- if (CGSizeEqualToSize(calculatedLayoutSize, bounds.size) == NO) {
- [self layoutThatFits:ASSizeRangeMake(bounds.size)];
- } else {
- [self layoutThatFits:_calculatedDisplayNodeLayout->constrainedSize];
- }
+ if (CGRectEqualToRect(bounds, CGRectZero)) {
+ LOG(@"Warning: No size given for node before node was trying to layout itself: %@. Please provide a frame for the node.", self);
+ } else {
+ if (CGSizeEqualToSize(calculatedLayoutSize, bounds.size) == NO) {
+ [self layoutThatFits:ASSizeRangeMake(bounds.size)];
}
}
}
diff --git a/AsyncDisplayKit/ASTextNode.mm b/AsyncDisplayKit/ASTextNode.mm
index 25ff6cd86a..741a3db4f8 100644
--- a/AsyncDisplayKit/ASTextNode.mm
+++ b/AsyncDisplayKit/ASTextNode.mm
@@ -237,6 +237,17 @@ static NSArray *DefaultLinkAttributeNames = @[ NSLinkAttributeName ];
return [self _rendererWithBounds:self.threadSafeBounds];
}
+- (ASTextKitRenderer *)_rendererWithBoundsSlow:(CGRect)bounds
+{
+ ASDN::MutexLocker l(__instanceLock__);
+
+ CGSize constrainedSize = bounds.size;
+ constrainedSize.width -= (_textContainerInset.left + _textContainerInset.right);
+ constrainedSize.height -= (_textContainerInset.top + _textContainerInset.bottom);
+ return [[ASTextKitRenderer alloc] initWithTextKitAttributes:[self _rendererAttributes]
+ constrainedSize:constrainedSize];
+}
+
- (ASTextKitRenderer *)_rendererWithBounds:(CGRect)bounds
{
ASDN::MutexLocker l(__instanceLock__);
@@ -404,7 +415,7 @@ static NSArray *DefaultLinkAttributeNames = @[ NSLinkAttributeName ];
[self setNeedsDisplay];
- CGSize size = [self _renderer].size;
+ CGSize size = [self _rendererWithBoundsSlow:{.size=constrainedSize}].size;
if (_attributedText.length > 0) {
self.style.ascender = [[self class] ascenderWithAttributedString:_attributedText];
self.style.descender = [[_attributedText attribute:NSFontAttributeName atIndex:_attributedText.length - 1 effectiveRange:NULL] descender];
@@ -537,7 +548,7 @@ static NSArray *DefaultLinkAttributeNames = @[ NSLinkAttributeName ];
CGContextTranslateCTM(context, _textContainerInset.left, _textContainerInset.top);
- ASTextKitRenderer *renderer = [self _rendererWithBounds:drawParameterBounds];
+ ASTextKitRenderer *renderer = [self _rendererWithBoundsSlow:drawParameterBounds];
// Fill background
if (backgroundColor != nil) {
diff --git a/examples/ASViewController/Sample.xcodeproj/project.pbxproj b/examples/ASViewController/Sample.xcodeproj/project.pbxproj
index eeef9f4c40..1d11b3492e 100644
--- a/examples/ASViewController/Sample.xcodeproj/project.pbxproj
+++ b/examples/ASViewController/Sample.xcodeproj/project.pbxproj
@@ -1,833 +1,395 @@
-
-
-
-
- archiveVersion
- 1
- classes
-
- objectVersion
- 46
- objects
-
- 06EE2E0ABEB6289D4775A867
-
- buildActionMask
- 2147483647
- files
-
- inputPaths
-
- isa
- PBXShellScriptBuildPhase
- name
- Copy Pods Resources
- outputPaths
-
- runOnlyForDeploymentPostprocessing
- 0
- shellPath
- /bin/sh
- shellScript
- "${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-resources.sh"
-
- showEnvVarsInLog
- 0
-
- 0DFDB4376BA084DAC7C1976E
-
- children
-
- 15AD337503831C4D33FF8B3A
- 97482F27BE2F7583EFE1BC2C
-
- isa
- PBXGroup
- name
- Pods
- sourceTree
- <group>
-
- 15AD337503831C4D33FF8B3A
-
- includeInIndex
- 1
- isa
- PBXFileReference
- lastKnownFileType
- text.xcconfig
- name
- Pods-Sample.debug.xcconfig
- path
- Pods/Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig
- sourceTree
- <group>
-
- 23FC03B282CBD9014D868DF6
-
- buildActionMask
- 2147483647
- files
-
- inputPaths
-
- isa
- PBXShellScriptBuildPhase
- name
- Embed Pods Frameworks
- outputPaths
-
- runOnlyForDeploymentPostprocessing
- 0
- shellPath
- /bin/sh
- shellScript
- "${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-frameworks.sh"
-
- showEnvVarsInLog
- 0
-
- 465082D55CCF1B0CB1AEBACC
-
- explicitFileType
- archive.ar
- includeInIndex
- 0
- isa
- PBXFileReference
- path
- libPods-Sample.a
- sourceTree
- BUILT_PRODUCTS_DIR
-
- 478C8D7C412DCBDFE14640D8
-
- children
-
- 465082D55CCF1B0CB1AEBACC
-
- isa
- PBXGroup
- name
- Frameworks
- sourceTree
- <group>
-
- 5CF3EF5E344946731D4F13F2
-
- fileRef
- 465082D55CCF1B0CB1AEBACC
- isa
- PBXBuildFile
-
- 694993C41C8B334F00491CA5
-
- children
-
- 694993CF1C8B334F00491CA5
- 694993CE1C8B334F00491CA5
- 0DFDB4376BA084DAC7C1976E
- 478C8D7C412DCBDFE14640D8
-
- isa
- PBXGroup
- sourceTree
- <group>
-
- 694993C51C8B334F00491CA5
-
- attributes
-
- LastUpgradeCheck
- 0720
- ORGANIZATIONNAME
- AsyncDisplayKit
- TargetAttributes
-
- 694993CC1C8B334F00491CA5
-
- CreatedOnToolsVersion
- 7.2.1
-
-
-
- buildConfigurationList
- 694993C81C8B334F00491CA5
- compatibilityVersion
- Xcode 3.2
- developmentRegion
- English
- hasScannedForEncodings
- 0
- isa
- PBXProject
- knownRegions
-
- en
- Base
-
- mainGroup
- 694993C41C8B334F00491CA5
- productRefGroup
- 694993CE1C8B334F00491CA5
- projectDirPath
-
- projectReferences
-
- projectRoot
-
- targets
-
- 694993CC1C8B334F00491CA5
-
-
- 694993C81C8B334F00491CA5
-
- buildConfigurations
-
- 694993E21C8B334F00491CA5
- 694993E31C8B334F00491CA5
-
- defaultConfigurationIsVisible
- 0
- defaultConfigurationName
- Release
- isa
- XCConfigurationList
-
- 694993C91C8B334F00491CA5
-
- buildActionMask
- 2147483647
- files
-
- 694993D81C8B334F00491CA5
- 694993D51C8B334F00491CA5
- 694993D21C8B334F00491CA5
- 69DCA5221C8B3D30006FF548
- 69DCA5281C8BE031006FF548
- 69DCA5251C8BE01F006FF548
-
- isa
- PBXSourcesBuildPhase
- runOnlyForDeploymentPostprocessing
- 0
-
- 694993CA1C8B334F00491CA5
-
- buildActionMask
- 2147483647
- files
-
- 5CF3EF5E344946731D4F13F2
-
- isa
- PBXFrameworksBuildPhase
- runOnlyForDeploymentPostprocessing
- 0
-
- 694993CB1C8B334F00491CA5
-
- buildActionMask
- 2147483647
- files
-
- 694993E01C8B334F00491CA5
- 694993DD1C8B334F00491CA5
-
- isa
- PBXResourcesBuildPhase
- runOnlyForDeploymentPostprocessing
- 0
-
- 694993CC1C8B334F00491CA5
-
- buildConfigurationList
- 694993E41C8B334F00491CA5
- buildPhases
-
- 80035273449C25F4B2E1454F
- 694993C91C8B334F00491CA5
- 694993CA1C8B334F00491CA5
- 694993CB1C8B334F00491CA5
- 06EE2E0ABEB6289D4775A867
- 23FC03B282CBD9014D868DF6
-
- buildRules
-
- dependencies
-
- isa
- PBXNativeTarget
- name
- Sample
- productName
- Sample
- productReference
- 694993CD1C8B334F00491CA5
- productType
- com.apple.product-type.application
-
- 694993CD1C8B334F00491CA5
-
- explicitFileType
- wrapper.application
- includeInIndex
- 0
- isa
- PBXFileReference
- path
- Sample.app
- sourceTree
- BUILT_PRODUCTS_DIR
-
- 694993CE1C8B334F00491CA5
-
- children
-
- 694993CD1C8B334F00491CA5
-
- isa
- PBXGroup
- name
- Products
- sourceTree
- <group>
-
- 694993CF1C8B334F00491CA5
-
- children
-
- 694993D31C8B334F00491CA5
- 694993D41C8B334F00491CA5
- 694993D61C8B334F00491CA5
- 694993D71C8B334F00491CA5
- 69DCA5201C8B3D30006FF548
- 69DCA5211C8B3D30006FF548
- 69DCA5231C8BE01F006FF548
- 69DCA5241C8BE01F006FF548
- 69DCA5261C8BE031006FF548
- 69DCA5271C8BE031006FF548
- 694993DC1C8B334F00491CA5
- 694993D01C8B334F00491CA5
-
- isa
- PBXGroup
- path
- Sample
- sourceTree
- <group>
-
- 694993D01C8B334F00491CA5
-
- children
-
- 694993E11C8B334F00491CA5
- 694993DE1C8B334F00491CA5
- 694993D11C8B334F00491CA5
-
- isa
- PBXGroup
- name
- Supporting Files
- sourceTree
- <group>
-
- 694993D11C8B334F00491CA5
-
- isa
- PBXFileReference
- lastKnownFileType
- sourcecode.c.objc
- path
- main.m
- sourceTree
- <group>
-
- 694993D21C8B334F00491CA5
-
- fileRef
- 694993D11C8B334F00491CA5
- isa
- PBXBuildFile
-
- 694993D31C8B334F00491CA5
-
- isa
- PBXFileReference
- lastKnownFileType
- sourcecode.c.h
- path
- AppDelegate.h
- sourceTree
- <group>
-
- 694993D41C8B334F00491CA5
-
- isa
- PBXFileReference
- lastKnownFileType
- sourcecode.c.objc
- path
- AppDelegate.m
- sourceTree
- <group>
-
- 694993D51C8B334F00491CA5
-
- fileRef
- 694993D41C8B334F00491CA5
- isa
- PBXBuildFile
-
- 694993D61C8B334F00491CA5
-
- isa
- PBXFileReference
- lastKnownFileType
- sourcecode.c.h
- path
- ViewController.h
- sourceTree
- <group>
-
- 694993D71C8B334F00491CA5
-
- isa
- PBXFileReference
- lastKnownFileType
- sourcecode.c.objc
- path
- ViewController.m
- sourceTree
- <group>
-
- 694993D81C8B334F00491CA5
-
- fileRef
- 694993D71C8B334F00491CA5
- isa
- PBXBuildFile
-
- 694993DC1C8B334F00491CA5
-
- isa
- PBXFileReference
- lastKnownFileType
- folder.assetcatalog
- path
- Assets.xcassets
- sourceTree
- <group>
-
- 694993DD1C8B334F00491CA5
-
- fileRef
- 694993DC1C8B334F00491CA5
- isa
- PBXBuildFile
-
- 694993DE1C8B334F00491CA5
-
- children
-
- 694993DF1C8B334F00491CA5
-
- isa
- PBXVariantGroup
- name
- LaunchScreen.storyboard
- sourceTree
- <group>
-
- 694993DF1C8B334F00491CA5
-
- isa
- PBXFileReference
- lastKnownFileType
- file.storyboard
- name
- Base
- path
- Base.lproj/LaunchScreen.storyboard
- sourceTree
- <group>
-
- 694993E01C8B334F00491CA5
-
- fileRef
- 694993DE1C8B334F00491CA5
- isa
- PBXBuildFile
-
- 694993E11C8B334F00491CA5
-
- isa
- PBXFileReference
- lastKnownFileType
- text.plist.xml
- path
- Info.plist
- sourceTree
- <group>
-
- 694993E21C8B334F00491CA5
-
- buildSettings
-
- ALWAYS_SEARCH_USER_PATHS
- NO
- CLANG_CXX_LANGUAGE_STANDARD
- gnu++0x
- CLANG_CXX_LIBRARY
- libc++
- CLANG_ENABLE_MODULES
- YES
- CLANG_ENABLE_OBJC_ARC
- YES
- CLANG_WARN_BOOL_CONVERSION
- YES
- CLANG_WARN_CONSTANT_CONVERSION
- YES
- CLANG_WARN_DIRECT_OBJC_ISA_USAGE
- YES_ERROR
- CLANG_WARN_EMPTY_BODY
- YES
- CLANG_WARN_ENUM_CONVERSION
- YES
- CLANG_WARN_INT_CONVERSION
- YES
- CLANG_WARN_OBJC_ROOT_CLASS
- YES_ERROR
- CLANG_WARN_UNREACHABLE_CODE
- YES
- CLANG_WARN__DUPLICATE_METHOD_MATCH
- YES
- CODE_SIGN_IDENTITY[sdk=iphoneos*]
- iPhone Developer
- COPY_PHASE_STRIP
- NO
- DEBUG_INFORMATION_FORMAT
- dwarf
- ENABLE_STRICT_OBJC_MSGSEND
- YES
- ENABLE_TESTABILITY
- YES
- GCC_C_LANGUAGE_STANDARD
- gnu99
- GCC_DYNAMIC_NO_PIC
- NO
- GCC_NO_COMMON_BLOCKS
- YES
- GCC_OPTIMIZATION_LEVEL
- 0
- GCC_PREPROCESSOR_DEFINITIONS
-
- DEBUG=1
- $(inherited)
-
- GCC_WARN_64_TO_32_BIT_CONVERSION
- YES
- GCC_WARN_ABOUT_RETURN_TYPE
- YES_ERROR
- GCC_WARN_UNDECLARED_SELECTOR
- YES
- GCC_WARN_UNINITIALIZED_AUTOS
- YES_AGGRESSIVE
- GCC_WARN_UNUSED_FUNCTION
- YES
- GCC_WARN_UNUSED_VARIABLE
- YES
- IPHONEOS_DEPLOYMENT_TARGET
- 7.0
- MTL_ENABLE_DEBUG_INFO
- YES
- ONLY_ACTIVE_ARCH
- YES
- SDKROOT
- iphoneos
-
- isa
- XCBuildConfiguration
- name
- Debug
-
- 694993E31C8B334F00491CA5
-
- buildSettings
-
- ALWAYS_SEARCH_USER_PATHS
- NO
- CLANG_CXX_LANGUAGE_STANDARD
- gnu++0x
- CLANG_CXX_LIBRARY
- libc++
- CLANG_ENABLE_MODULES
- YES
- CLANG_ENABLE_OBJC_ARC
- YES
- CLANG_WARN_BOOL_CONVERSION
- YES
- CLANG_WARN_CONSTANT_CONVERSION
- YES
- CLANG_WARN_DIRECT_OBJC_ISA_USAGE
- YES_ERROR
- CLANG_WARN_EMPTY_BODY
- YES
- CLANG_WARN_ENUM_CONVERSION
- YES
- CLANG_WARN_INT_CONVERSION
- YES
- CLANG_WARN_OBJC_ROOT_CLASS
- YES_ERROR
- CLANG_WARN_UNREACHABLE_CODE
- YES
- CLANG_WARN__DUPLICATE_METHOD_MATCH
- YES
- CODE_SIGN_IDENTITY[sdk=iphoneos*]
- iPhone Developer
- COPY_PHASE_STRIP
- NO
- DEBUG_INFORMATION_FORMAT
- dwarf-with-dsym
- ENABLE_NS_ASSERTIONS
- NO
- ENABLE_STRICT_OBJC_MSGSEND
- YES
- GCC_C_LANGUAGE_STANDARD
- gnu99
- GCC_NO_COMMON_BLOCKS
- YES
- GCC_WARN_64_TO_32_BIT_CONVERSION
- YES
- GCC_WARN_ABOUT_RETURN_TYPE
- YES_ERROR
- GCC_WARN_UNDECLARED_SELECTOR
- YES
- GCC_WARN_UNINITIALIZED_AUTOS
- YES_AGGRESSIVE
- GCC_WARN_UNUSED_FUNCTION
- YES
- GCC_WARN_UNUSED_VARIABLE
- YES
- IPHONEOS_DEPLOYMENT_TARGET
- 7.0
- MTL_ENABLE_DEBUG_INFO
- NO
- SDKROOT
- iphoneos
- VALIDATE_PRODUCT
- YES
-
- isa
- XCBuildConfiguration
- name
- Release
-
- 694993E41C8B334F00491CA5
-
- buildConfigurations
-
- 694993E51C8B334F00491CA5
- 694993E61C8B334F00491CA5
-
- defaultConfigurationIsVisible
- 0
- defaultConfigurationName
- Release
- isa
- XCConfigurationList
-
- 694993E51C8B334F00491CA5
-
- baseConfigurationReference
- 15AD337503831C4D33FF8B3A
- buildSettings
-
- ASSETCATALOG_COMPILER_APPICON_NAME
- AppIcon
- INFOPLIST_FILE
- Sample/Info.plist
- LD_RUNPATH_SEARCH_PATHS
- $(inherited) @executable_path/Frameworks
- PRODUCT_BUNDLE_IDENTIFIER
- org.AsyncDisplayKit.Sample
- PRODUCT_NAME
- $(TARGET_NAME)
-
- isa
- XCBuildConfiguration
- name
- Debug
-
- 694993E61C8B334F00491CA5
-
- baseConfigurationReference
- 97482F27BE2F7583EFE1BC2C
- buildSettings
-
- ASSETCATALOG_COMPILER_APPICON_NAME
- AppIcon
- INFOPLIST_FILE
- Sample/Info.plist
- LD_RUNPATH_SEARCH_PATHS
- $(inherited) @executable_path/Frameworks
- PRODUCT_BUNDLE_IDENTIFIER
- org.AsyncDisplayKit.Sample
- PRODUCT_NAME
- $(TARGET_NAME)
-
- isa
- XCBuildConfiguration
- name
- Release
-
- 69DCA5201C8B3D30006FF548
-
- fileEncoding
- 4
- isa
- PBXFileReference
- lastKnownFileType
- sourcecode.c.h
- path
- DetailViewController.h
- sourceTree
- <group>
-
- 69DCA5211C8B3D30006FF548
-
- fileEncoding
- 4
- isa
- PBXFileReference
- lastKnownFileType
- sourcecode.c.objc
- path
- DetailViewController.m
- sourceTree
- <group>
-
- 69DCA5221C8B3D30006FF548
-
- fileRef
- 69DCA5211C8B3D30006FF548
- isa
- PBXBuildFile
-
- 69DCA5231C8BE01F006FF548
-
- fileEncoding
- 4
- isa
- PBXFileReference
- lastKnownFileType
- sourcecode.c.h
- path
- DetailRootNode.h
- sourceTree
- <group>
-
- 69DCA5241C8BE01F006FF548
-
- fileEncoding
- 4
- isa
- PBXFileReference
- lastKnownFileType
- sourcecode.c.objc
- path
- DetailRootNode.m
- sourceTree
- <group>
-
- 69DCA5251C8BE01F006FF548
-
- fileRef
- 69DCA5241C8BE01F006FF548
- isa
- PBXBuildFile
-
- 69DCA5261C8BE031006FF548
-
- fileEncoding
- 4
- isa
- PBXFileReference
- lastKnownFileType
- sourcecode.c.h
- path
- DetailCellNode.h
- sourceTree
- <group>
-
- 69DCA5271C8BE031006FF548
-
- fileEncoding
- 4
- isa
- PBXFileReference
- lastKnownFileType
- sourcecode.c.objc
- path
- DetailCellNode.m
- sourceTree
- <group>
-
- 69DCA5281C8BE031006FF548
-
- fileRef
- 69DCA5271C8BE031006FF548
- isa
- PBXBuildFile
-
- 80035273449C25F4B2E1454F
-
- buildActionMask
- 2147483647
- files
-
- inputPaths
-
- isa
- PBXShellScriptBuildPhase
- name
- Check Pods Manifest.lock
- outputPaths
-
- runOnlyForDeploymentPostprocessing
- 0
- shellPath
- /bin/sh
- shellScript
- diff "${PODS_ROOT}/../Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
-if [[ $? != 0 ]] ; then
- cat << EOM
-error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
-EOM
- exit 1
-fi
-
- showEnvVarsInLog
- 0
-
- 97482F27BE2F7583EFE1BC2C
-
- includeInIndex
- 1
- isa
- PBXFileReference
- lastKnownFileType
- text.xcconfig
- name
- Pods-Sample.release.xcconfig
- path
- Pods/Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig
- sourceTree
- <group>
-
-
- rootObject
- 694993C51C8B334F00491CA5
-
-
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 5CF3EF5E344946731D4F13F2 /* libPods-Sample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 465082D55CCF1B0CB1AEBACC /* libPods-Sample.a */; };
+ 694993D21C8B334F00491CA5 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 694993D11C8B334F00491CA5 /* main.m */; };
+ 694993D51C8B334F00491CA5 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 694993D41C8B334F00491CA5 /* AppDelegate.m */; };
+ 694993D81C8B334F00491CA5 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 694993D71C8B334F00491CA5 /* ViewController.m */; };
+ 694993DD1C8B334F00491CA5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 694993DC1C8B334F00491CA5 /* Assets.xcassets */; };
+ 694993E01C8B334F00491CA5 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 694993DE1C8B334F00491CA5 /* LaunchScreen.storyboard */; };
+ 698247E91DD51C8D004D1E37 /* SampleSizingNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 698247E81DD51C8D004D1E37 /* SampleSizingNode.m */; };
+ 69DCA5221C8B3D30006FF548 /* DetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 69DCA5211C8B3D30006FF548 /* DetailViewController.m */; };
+ 69DCA5251C8BE01F006FF548 /* DetailRootNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 69DCA5241C8BE01F006FF548 /* DetailRootNode.m */; };
+ 69DCA5281C8BE031006FF548 /* DetailCellNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 69DCA5271C8BE031006FF548 /* DetailCellNode.m */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 15AD337503831C4D33FF8B3A /* Pods-Sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig"; sourceTree = ""; };
+ 465082D55CCF1B0CB1AEBACC /* libPods-Sample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Sample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
+ 694993CD1C8B334F00491CA5 /* Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Sample.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 694993D11C8B334F00491CA5 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
+ 694993D31C8B334F00491CA5 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
+ 694993D41C8B334F00491CA5 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
+ 694993D61C8B334F00491CA5 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; };
+ 694993D71C8B334F00491CA5 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; };
+ 694993DC1C8B334F00491CA5 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
+ 694993DF1C8B334F00491CA5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
+ 694993E11C8B334F00491CA5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
+ 698247E71DD51C8D004D1E37 /* SampleSizingNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SampleSizingNode.h; sourceTree = ""; };
+ 698247E81DD51C8D004D1E37 /* SampleSizingNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SampleSizingNode.m; sourceTree = ""; };
+ 69DCA5201C8B3D30006FF548 /* DetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetailViewController.h; sourceTree = ""; };
+ 69DCA5211C8B3D30006FF548 /* DetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DetailViewController.m; sourceTree = ""; };
+ 69DCA5231C8BE01F006FF548 /* DetailRootNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetailRootNode.h; sourceTree = ""; };
+ 69DCA5241C8BE01F006FF548 /* DetailRootNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DetailRootNode.m; sourceTree = ""; };
+ 69DCA5261C8BE031006FF548 /* DetailCellNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetailCellNode.h; sourceTree = ""; };
+ 69DCA5271C8BE031006FF548 /* DetailCellNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DetailCellNode.m; sourceTree = ""; };
+ 97482F27BE2F7583EFE1BC2C /* Pods-Sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.release.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig"; sourceTree = ""; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 694993CA1C8B334F00491CA5 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 5CF3EF5E344946731D4F13F2 /* libPods-Sample.a in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 0DFDB4376BA084DAC7C1976E /* Pods */ = {
+ isa = PBXGroup;
+ children = (
+ 15AD337503831C4D33FF8B3A /* Pods-Sample.debug.xcconfig */,
+ 97482F27BE2F7583EFE1BC2C /* Pods-Sample.release.xcconfig */,
+ );
+ name = Pods;
+ sourceTree = "";
+ };
+ 478C8D7C412DCBDFE14640D8 /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 465082D55CCF1B0CB1AEBACC /* libPods-Sample.a */,
+ );
+ name = Frameworks;
+ sourceTree = "";
+ };
+ 694993C41C8B334F00491CA5 = {
+ isa = PBXGroup;
+ children = (
+ 694993CF1C8B334F00491CA5 /* Sample */,
+ 694993CE1C8B334F00491CA5 /* Products */,
+ 0DFDB4376BA084DAC7C1976E /* Pods */,
+ 478C8D7C412DCBDFE14640D8 /* Frameworks */,
+ );
+ sourceTree = "";
+ };
+ 694993CE1C8B334F00491CA5 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 694993CD1C8B334F00491CA5 /* Sample.app */,
+ );
+ name = Products;
+ sourceTree = "";
+ };
+ 694993CF1C8B334F00491CA5 /* Sample */ = {
+ isa = PBXGroup;
+ children = (
+ 694993D31C8B334F00491CA5 /* AppDelegate.h */,
+ 694993D41C8B334F00491CA5 /* AppDelegate.m */,
+ 694993D61C8B334F00491CA5 /* ViewController.h */,
+ 694993D71C8B334F00491CA5 /* ViewController.m */,
+ 69DCA5201C8B3D30006FF548 /* DetailViewController.h */,
+ 69DCA5211C8B3D30006FF548 /* DetailViewController.m */,
+ 69DCA5231C8BE01F006FF548 /* DetailRootNode.h */,
+ 69DCA5241C8BE01F006FF548 /* DetailRootNode.m */,
+ 69DCA5261C8BE031006FF548 /* DetailCellNode.h */,
+ 69DCA5271C8BE031006FF548 /* DetailCellNode.m */,
+ 694993DC1C8B334F00491CA5 /* Assets.xcassets */,
+ 694993D01C8B334F00491CA5 /* Supporting Files */,
+ 698247E71DD51C8D004D1E37 /* SampleSizingNode.h */,
+ 698247E81DD51C8D004D1E37 /* SampleSizingNode.m */,
+ );
+ path = Sample;
+ sourceTree = "";
+ };
+ 694993D01C8B334F00491CA5 /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 694993E11C8B334F00491CA5 /* Info.plist */,
+ 694993DE1C8B334F00491CA5 /* LaunchScreen.storyboard */,
+ 694993D11C8B334F00491CA5 /* main.m */,
+ );
+ name = "Supporting Files";
+ sourceTree = "";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 694993CC1C8B334F00491CA5 /* Sample */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 694993E41C8B334F00491CA5 /* Build configuration list for PBXNativeTarget "Sample" */;
+ buildPhases = (
+ 80035273449C25F4B2E1454F /* [CP] Check Pods Manifest.lock */,
+ 694993C91C8B334F00491CA5 /* Sources */,
+ 694993CA1C8B334F00491CA5 /* Frameworks */,
+ 694993CB1C8B334F00491CA5 /* Resources */,
+ 06EE2E0ABEB6289D4775A867 /* [CP] Copy Pods Resources */,
+ 23FC03B282CBD9014D868DF6 /* [CP] Embed Pods Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = Sample;
+ productName = Sample;
+ productReference = 694993CD1C8B334F00491CA5 /* Sample.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 694993C51C8B334F00491CA5 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0720;
+ ORGANIZATIONNAME = AsyncDisplayKit;
+ TargetAttributes = {
+ 694993CC1C8B334F00491CA5 = {
+ CreatedOnToolsVersion = 7.2.1;
+ };
+ };
+ };
+ buildConfigurationList = 694993C81C8B334F00491CA5 /* Build configuration list for PBXProject "Sample" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ Base,
+ );
+ mainGroup = 694993C41C8B334F00491CA5;
+ productRefGroup = 694993CE1C8B334F00491CA5 /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 694993CC1C8B334F00491CA5 /* Sample */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 694993CB1C8B334F00491CA5 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 694993E01C8B334F00491CA5 /* LaunchScreen.storyboard in Resources */,
+ 694993DD1C8B334F00491CA5 /* Assets.xcassets in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+ 06EE2E0ABEB6289D4775A867 /* [CP] Copy Pods Resources */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "[CP] Copy Pods Resources";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-resources.sh\"\n";
+ showEnvVarsInLog = 0;
+ };
+ 23FC03B282CBD9014D868DF6 /* [CP] Embed Pods Frameworks */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "[CP] Embed Pods Frameworks";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-frameworks.sh\"\n";
+ showEnvVarsInLog = 0;
+ };
+ 80035273449C25F4B2E1454F /* [CP] Check Pods Manifest.lock */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "[CP] Check Pods Manifest.lock";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
+ showEnvVarsInLog = 0;
+ };
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 694993C91C8B334F00491CA5 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 694993D81C8B334F00491CA5 /* ViewController.m in Sources */,
+ 694993D51C8B334F00491CA5 /* AppDelegate.m in Sources */,
+ 698247E91DD51C8D004D1E37 /* SampleSizingNode.m in Sources */,
+ 694993D21C8B334F00491CA5 /* main.m in Sources */,
+ 69DCA5221C8B3D30006FF548 /* DetailViewController.m in Sources */,
+ 69DCA5281C8BE031006FF548 /* DetailCellNode.m in Sources */,
+ 69DCA5251C8BE01F006FF548 /* DetailRootNode.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ 694993DE1C8B334F00491CA5 /* LaunchScreen.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 694993DF1C8B334F00491CA5 /* Base */,
+ );
+ name = LaunchScreen.storyboard;
+ sourceTree = "";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 694993E21C8B334F00491CA5 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 7.0;
+ MTL_ENABLE_DEBUG_INFO = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = iphoneos;
+ };
+ name = Debug;
+ };
+ 694993E31C8B334F00491CA5 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 7.0;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = iphoneos;
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ 694993E51C8B334F00491CA5 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 15AD337503831C4D33FF8B3A /* Pods-Sample.debug.xcconfig */;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ INFOPLIST_FILE = Sample/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = org.AsyncDisplayKit.Sample;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ 694993E61C8B334F00491CA5 /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 97482F27BE2F7583EFE1BC2C /* Pods-Sample.release.xcconfig */;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ INFOPLIST_FILE = Sample/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = org.AsyncDisplayKit.Sample;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 694993C81C8B334F00491CA5 /* Build configuration list for PBXProject "Sample" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 694993E21C8B334F00491CA5 /* Debug */,
+ 694993E31C8B334F00491CA5 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 694993E41C8B334F00491CA5 /* Build configuration list for PBXNativeTarget "Sample" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 694993E51C8B334F00491CA5 /* Debug */,
+ 694993E61C8B334F00491CA5 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 694993C51C8B334F00491CA5 /* Project object */;
+}
diff --git a/examples/ASViewController/Sample/DetailRootNode.m b/examples/ASViewController/Sample/DetailRootNode.m
index 333af36e6c..11091cea05 100644
--- a/examples/ASViewController/Sample/DetailRootNode.m
+++ b/examples/ASViewController/Sample/DetailRootNode.m
@@ -28,6 +28,8 @@ static const NSInteger kImageHeight = 200;
@property (nonatomic, copy) NSString *imageCategory;
@property (nonatomic, strong) ASCollectionNode *collectionNode;
+@property (nonatomic, strong) ASDisplayNode *backgroundNode;
+
@end
diff --git a/examples/ASViewController/Sample/DetailViewController.m b/examples/ASViewController/Sample/DetailViewController.m
index 6b6b1a902b..f9f243ce79 100644
--- a/examples/ASViewController/Sample/DetailViewController.m
+++ b/examples/ASViewController/Sample/DetailViewController.m
@@ -19,9 +19,36 @@
#import
#import "DetailRootNode.h"
+#import "SampleSizingNode.h"
+
+@interface DetailViewController ()
+@property (strong, nonatomic) SampleSizingNode *sizingNode;
+
+@end
@implementation DetailViewController
+#pragma mark - Lifecycle
+
+- (instancetype)initWithNode:(DetailRootNode *)node
+{
+ self = [super initWithNode:node];
+
+ // Set the sizing delegate of the root node to the container
+ self.sizingNode = [SampleSizingNode new];
+ self.sizingNode.autoresizingMask = UIViewAutoresizingNone;
+ self.sizingNode.delegate = self;
+
+ return self;
+}
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+
+ [self.view addSubnode:self.sizingNode];
+}
+
#pragma mark - Rotation
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator
@@ -30,4 +57,32 @@
[self.node.collectionNode.view.collectionViewLayout invalidateLayout];
}
+- (void)viewDidLayoutSubviews
+{
+ [super viewDidLayoutSubviews];
+
+ [self updateNodeLayout];
+}
+
+#pragma mark - Update the node based on the new size
+
+- (void)displayNodeDidInvalidateSize:(ASDisplayNode *)displayNode
+{
+ // ASDisplayNodeSizingDelegate / ASDisplayNodeSizingHandlers
+ [self updateNodeLayout];
+}
+
+- (void)updateNodeLayout
+{
+ // Adjust the layout on the new layout
+
+ // Use the bounds of the view and get the fitting size
+ CGSize size = [self.sizingNode sizeThatFits:CGSizeMake(CGFLOAT_MAX, 100.0)];
+ size.width -= 10;
+ //[self.sizingNode setNeedsLayout];
+ self.sizingNode.frame = CGRectMake((self.view.bounds.size.width - size.width) / 2.0,
+ (self.view.bounds.size.height - size.height) / 2.0,
+ size.width, size.height);
+}
+
@end
diff --git a/examples/ASViewController/Sample/SampleSizingNode.h b/examples/ASViewController/Sample/SampleSizingNode.h
new file mode 100644
index 0000000000..6543006cf3
--- /dev/null
+++ b/examples/ASViewController/Sample/SampleSizingNode.h
@@ -0,0 +1,17 @@
+//
+// SampleSizingNode.h
+// Sample
+//
+// Created by Michael Schneider on 11/10/16.
+// Copyright © 2016 AsyncDisplayKit. All rights reserved.
+//
+
+#import
+
+@interface ASDisplayNodeSizingDelegate : NSObject
+- (void)displayNodeDidInvalidateSize:(ASDisplayNode *)displayNode;
+@end
+
+@interface SampleSizingNode : ASDisplayNode
+@property (nonatomic, weak) id delegate;
+@end
diff --git a/examples/ASViewController/Sample/SampleSizingNode.m b/examples/ASViewController/Sample/SampleSizingNode.m
new file mode 100644
index 0000000000..703135be13
--- /dev/null
+++ b/examples/ASViewController/Sample/SampleSizingNode.m
@@ -0,0 +1,86 @@
+//
+// SampleSizingNode.m
+// Sample
+//
+// Created by Michael Schneider on 11/10/16.
+// Copyright © 2016 AsyncDisplayKit. All rights reserved.
+//
+
+#import "SampleSizingNode.h"
+
+@interface SampleSizingNode ()
+@property (nonatomic, strong) ASDisplayNode *subnode;
+@property (nonatomic, assign) NSInteger state;
+
+@property (nonatomic, strong) ASTextNode *textNode;
+@end
+
+@implementation SampleSizingNode
+
+- (instancetype)init
+{
+ self = [super init];
+ if (self) {
+
+ self.automaticallyManagesSubnodes = YES;
+
+ //_subnode = [ASDisplayNode new];
+ //_subnode.backgroundColor = [UIColor redColor];
+
+ _textNode = [ASTextNode new];
+ _textNode.backgroundColor = [UIColor blueColor];
+ _textNode.autoresizingMask = UIViewAutoresizingNone;
+
+ _state = 0;
+ }
+ return self;
+}
+
+- (void)didLoad
+{
+ [super didLoad];
+
+ [self stateChanged];
+
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+ self.state = 1;
+ });
+}
+
+#pragma mark - State Management
+
+- (void)setState:(NSInteger)state
+{
+ _state = state;
+ [self stateChanged];
+}
+
+- (void)stateChanged
+{
+ NSString *text = self.state == 0 ? @"Bla Bla" : @"Bla Blaa sd fkj as;l dkf";
+ self.textNode.attributedText = [[NSAttributedString alloc] initWithString:text];
+
+ // Invalidate the layout for now and bubble it up until the root node to let the size provider know that
+ // that a size change happened
+ [self setNeedsLayout];
+
+ // If someone calls `setNeedsLayout` we have to inform the sizing delegate of the root node to be able
+ // to let them now that a size change happened
+ if ([self.delegate respondsToSelector:@selector(displayNodeDidInvalidateSize:)]) {
+ [self.delegate performSelector:@selector(displayNodeDidInvalidateSize:) withObject:self];
+ }
+}
+
+
+#pragma mark - ASDisplayNode
+
+- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
+{
+ // Layout description based on state
+ //self.subnode.style.preferredSize = constrainedSize.max;
+ UIEdgeInsets insets = UIEdgeInsetsMake(10, 10, 10, 10);
+ return [ASInsetLayoutSpec insetLayoutSpecWithInsets:insets child:_textNode];
+}
+
+
+@end