Open
Description
From @eanagel on February 23, 2016 20:31
Also published in StackOverflow
I'm trying to enforce a maximum height for an element and I can't figure out exactly which LayoutSpec can help me do that. It seems like the sizeRange
property is what I would expect to work but that appears to work only with ASStaticLayoutSpec
, which seems like more of a last resort option. (This element I need to constrain is contained in an ASInsetLayoutSpec
in my case.)
Here's my attempt:
CGSize max = CGSizeMake(constrainedSize.max.width, [self.class maxSinglePhotoHeight]);
_singlePhotoNode.sizeRange = ASRelativeSizeRangeMake(ASRelativeSizeMakeWithCGSize(constrainedSize.min), ASRelativeSizeMakeWithCGSize(max));
ASInsetLayoutSpec *inset = [ASInsetLayoutSpec insetLayoutSpecWithInsets:PHOTO_INSET child:_singlePhotoNode];
Copied from original issue: facebookarchive/AsyncDisplayKit#1264