0

How do you make the control ASdisplayNode highly consistent with the cell?

-  (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize{
NSMutableArray *rightArray =[[NSMutableArray alloc]initWithObjects:_titleNode, _descNode,nil];
[rightArray addObjectsFromArray:_replayNodes];
ASStackLayoutSpec *verStackLayout = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical spacing:8 justifyContent:ASStackLayoutJustifyContentStart alignItems:ASStackLayoutAlignItemsStart children:rightArray];
verStackLayout.style.flexGrow = YES;
verStackLayout.style.flexShrink  = YES;
self.dateNode.style.preferredSize =  CGSizeMake(130 ,50);//How high is the height of cell?
self.dateNode.style.flexShrink = YES;
 ASStackLayoutSpec *horStackLayout = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal spacing:10 justifyContent:ASStackLayoutJustifyContentStart alignItems:ASStackLayoutAlignItemsStart children:@[self.dateNode,verStackLayout]];
horStackLayout.style.flexShrink = YES;
return horStackLayout;
}

enter image description here

freda
  • 1
  • 3
  • look on this example: https://github.com/TextureGroup/Texture/tree/master/examples/VerticalWithinHorizontalScrolling – Bimawa Aug 17 '17 at 23:46
  • Thank you, but it's not my problem. My line varies with the height of the ASTableNode-cell. It's not a fixed value. – freda Aug 18 '17 at 08:10

1 Answers1

0

Try this code and tell what you got?

-  (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize{
NSMutableArray *rightArray =[[NSMutableArray alloc]initWithObjects:_titleNode, _descNode,nil];
[rightArray addObjectsFromArray:_replayNodes];
ASStackLayoutSpec *verStackLayout = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical spacing:8 justifyContent:ASStackLayoutJustifyContentStart alignItems:ASStackLayoutAlignItemsStretch children:rightArray];
verStackLayout.style.flexGrow = YES;
verStackLayout.style.flexShrink  = YES;
self.dateNode.style.flexShrink = YES;
ASStackLayoutSpec *horStackLayout = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal spacing:10 justifyContent:ASStackLayoutJustifyContentStart alignItems:ASStackLayoutAlignItemsStretch children:@[self.dateNode,verStackLayout]];
horStackLayout.style.flexShrink = YES;
horStackLayout.style.flexGrow = YES;
horStackLayout.style.alignSelf = ASStackLayoutAlignItemsStretch;
return horStackLayout;
}
Bimawa
  • 3,535
  • 2
  • 25
  • 45
  • self.dateNode is not preferredSize. It cannot be displayed . – freda Aug 21 '17 at 09:35
  • Cannot calculate size of node: constrainedSize is infinite and node does not override -calculateSizeThatFits: or specify a preferredSize. Try setting style.preferredSize. Node: < alpha:1.00 isLayerBacked:1 frame:{{0, 0}, {0, 0}} (null)> – freda Aug 21 '17 at 09:48
  • @freda can u share simple example, i'll try do ur task. – Bimawa Aug 22 '17 at 10:37