0

Table Cell

enter image description here I'm learning to use Asyncdisplaykit. My result is in picture below. But I don't know how to constraint button equal Screen.width/3, Its auto constraints equal image width. This is my code

    let controlStack = ASStackLayoutSpec(direction: ASStackLayoutDirection.Horizontal, spacing: 3.0, justifyContent: ASStackLayoutJustifyContent.Center, alignItems: ASStackLayoutAlignItems.Center, children: [self.mFavoriteButton, self.mCommentButton, self.mShareButton])
    controlStack.spacingAfter = 3.0
    controlStack.spacingBefore = 3.0

    let insetDateLayout = ASInsetLayoutSpec(insets: UIEdgeInsets(top: 10, left: self.frame.size.width - 100, bottom: 0, right: 0), child: self.mDateTimeNode)
    let imageLayout = ASStaticLayoutSpec(children: [imagePlace, insetDateLayout])


    return ASStackLayoutSpec(direction: .Vertical, spacing: 3.0, justifyContent: ASStackLayoutJustifyContent.Start, alignItems: ASStackLayoutAlignItems.Center, children:[imageLayout, self.mMessageNode, controlStack])
Ahmad Raza
  • 2,850
  • 1
  • 21
  • 37

2 Answers2

2

try change ASStackLayoutAlignItems.Center to ASStackLayoutAlignItems.Stretch. And try enable Grow Constraints for buttons (need to test it):

self.mFavoriteButton.flexGrow = true;
self.mCommentButton.flexGrow = true;
self.mShareButton.flexGrow = true;
Bimawa
  • 3,535
  • 2
  • 25
  • 45
0

Reply if you were able to address the problem!

Typically you want to use flexBasis with a relative size of 0.33 to do 1/3rd. Check out documentation on Web / CSS flexbox for examples of flexbasis.

Michał Perłakowski
  • 88,409
  • 26
  • 156
  • 177