我尝试在 cellnode 内创建 stacklayout,但屏幕上没有显示
class Node: ASCellNode {
let blackNode = ASDisplayNode()
let blueNode = ASDisplayNode()
override init() {
super.init()
self.addSubnode(blueNode)
self.addSubnode(blackNode)
}
override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec {
blackNode.backgroundColor = .black
blueNode.backgroundColor = .blue
let contentStackSpec = ASStackLayoutSpec(direction: .horizontal,
spacing: 40,
justifyContent: .start,
alignItems: .center,
children: [blackNode, blueNode])
contentStackSpec.style.minWidth = ASDimensionMakeWithPoints(60.0);
contentStackSpec.style.maxHeight = ASDimensionMakeWithPoints(40.0);
return ASRelativeLayoutSpec(horizontalPosition: .center, verticalPosition: .center, sizingOption: .init(rawValue: 0), child: contentStackSpec)
}
}
我究竟做错了什么 ?