0

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];
Ethan
  • 486
  • 1
  • 6
  • 15
  • `ASLayoutSpec` by default try get full size if its possible. it get this information from `constrainedSize`. can u show screenshot (makeup) what u need, and i try construct LayoutSpec for u? – Bimawa Mar 22 '16 at 04:04

1 Answers1

0

I'm found this:

ASInsetLayoutSpec *insetLayoutSpec = [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(INFINITY, INFINITY, INFINITY, INFINITY) child:self.displayNode];

But be sure max size must not be inf in param, or u go in infinity layouts loop.

Bimawa
  • 3,535
  • 2
  • 25
  • 45