Open Pranoy1c opened 1 year ago
ASCornerLayoutSpec
is not the best solution for the cell, as part of the node will be cut off even with clipsToBounds = false
:
As an option, a combination of ASOverlayLayoutSpec
and ASRelativeLayoutSpec
may be suitable:
override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec {
let paddingToUse = 15.0;
let contentView = ASInsetLayoutSpec(insets: UIEdgeInsets(top: paddingToUse, left: paddingToUse, bottom: paddingToUse, right: paddingToUse), child: ASStackLayoutSpec(direction: .horizontal, spacing: 5, justifyContent: .spaceBetween, alignItems: .notSet, children: [titleNode]))
return ASOverlayLayoutSpec(
child: contentView,
overlay: ASRelativeLayoutSpec(
horizontalPosition: .end,
verticalPosition: .end,
sizingOption: .minimumSize,
child: savedIconNode
)
)
}
Result:
I am very new to
Texture/AsyncDisplayKit
. I am able to reproduce the issue with this simple code.I basically want to show a 10x10 square at the bottom right of the
ASCellNode
. I am doing this via aASDisplayNode
which is being set as the corner of aASCornerLayoutSpec
. I have set thestyle.preferredSize
of theASDisplayNode
toCGSize(width: 10, height: 10)
.For some reason, the width is not working and showing up as 50% of the screen width:
Code:
Any idea what am I doing wrong?