Closed christianselig closed 7 years ago
@christianselig In horizontalSpec2
you might want to set alignItems: .stretch
so that the insetSpec
will always fill the height of the horizontal stack.
@Adlai-Holler Oh wow, good call, thank you so much!
That worked 95%! It still yells at me about constrainedSize being infinite, however:
2017-01-31 17:19:14.309337 AsyncDisplayKitTest[1977:514552] Cannot calculate size of node: constrainedSize is infinite and node does not override -calculateSizeThatFits: or specify a preferredSize. Try setting style.preferredSize. Node: <<ASDisplayNode: 0x143e529a0> alpha:1.00 isLayerBacked:0 frame:{{0, 0}, {0, 0}} (null)>
@rewcraig in Slack solved the last step, the key was:
try lineNode.style.preferredSize = CGSize(width: 3.0, height: 0) rather than setting lineNode.style.width & lineNode.style.height
Which worked delightfully! I'm admittedly a little confused why (any documentation on this by chance?) but it's not the craziest thing and works well.
Argh, while it visually works, the provided solution does not work alongside ASCellNode
being selected (lineNode
disappears).
Try enabling isLayerBacked
on the lineNode
. It might help prevent UIKit from trying to be smart and automatically changing your views' background colors during selection.
@rewandy Bingo!
Using the latest version of AsyncDisplayKit (2.0.2), I'm attempting to layout a 3px wide vertical line the full height of the cell on the left side, as shown here:
ASTableNode
set up is very straightforward:And the
ASCellNode
subclass is set up as follows:The
layoutSpecThatFits
method is obviously the root of the issue, but I cannot for the life of me figure out how to simply position the line so it hugs the left side and its height spans the full height of the cell. If I simply returninsetSpec
in the above block, it works perfectly, but the addition of the line really messes everything up, and I'm at a loss as to how to fix it.This code doesn't show the
lineNode
and logs this issue many times:If I do as it suggests and add
lineNode.preferredSize = CGSize(width: 3.0, height: 20.0)
it "works", but the height is hardcoded and as the layout is dynamic it doesn't really work.Sample Project: LineNodeTest.zip