In the end, it looks like the best thing to do is use an NSTableCellView
with two NSView
s for the top and bottom half. I had the case of this as well as the NSStackView
working. But in the end, I found that using NSStackView
to collapse or expand requires a call to make noteHeightOfRows
work anyways.
So it would initially seem that it's not worth the effort of expanding it unless I have a more complicated cell where say I wanted a top, middle, and bottom, where the middle could expand and contract. While I would still need to use noteHeightOfRows
, it would allow for it.
However, there is one benefit of using the NSStackView
. The animation is much smoother for the collapse. I've found the NSTableCellView
method with a top and bottom NSView
shows signs of "tearing" as it collapses. This is what appears in the bottom edge, while horizontal, jitters. This is particularly apparent if you either spam the button or if the cell is selected because the bottom of the outline can sometimes grow in height.
I also found that when using NSAnimationContext
to help make it look a little smoother, I'd see strange behavior. Like the hide would happen at the wrong time (even though it was in the completionHandler
. I think the root cause of that are what becomes overlapping animations.