How can you get an NSButton
to detach from an NSStackView
when the stack view resizes?
NSControl
subclasses that use NSCell
drawing seem to have a different mind than other NSView
subclasses on visibility with compression resistance in Auto Layout.
NSStackView
doesn't seem to make a difference here either.
If I set the Visibility Priority for a control higher than 1, it will not drop. If I set it to 0, well, of course it will only drop and never appear.
How is this supposed to work?
What does it take to get a button or other control to drop when the stack view is resized smaller?
Maybe it's the dearth of docs and examples of NSStackView
...
Before I saw any views detach, I had to do two things:
Call
-[NSStackView setClippingResistancePriority:forOrientation:]
. If the size of the stack view is tied to the size of the window, the priority needs to be less thanNSLayoutPriorityWindowSizeStayPut
(500) or the stack view doesn't allow the window to get smaller than its content.Each time I added a view to the stack view that I wanted to detach, call
-[NSStackView setVisibilityPriority:forView:]
for that view.