我正在尝试为元素强制执行最大高度,但我无法准确确定哪个 LayoutSpec 可以帮助我做到这一点。似乎该sizeRange
属性是我希望使用的,但它似乎仅适用于ASStaticLayoutSpec
,这似乎更像是最后的选择。(我需要约束的这个元素包含ASInsetLayoutSpec
在我的案例中。)
这是我的尝试:
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];