objective-ccocoaswifttogglenssplitview

How to toggle visibility of NSSplitView subView + hide Pane Splitter divider?


We have a parent Split view (NSSplitView), and two subviews, Content and SideBar (the sidebar is on the right).

What would be the optimal Cocoa-friendly way to toggle the SideBar view?

HINT : I've been trying to do that, but still I had issues hiding the divider of the NSSplitView as well. How could I do it, while hiding it at the same time?


Solution

  • Here's a pretty decent tutorial that shows how to do this: Unraveling the Mysteries of NSSplitView.

    Hiding the divider is done in NSSplitView's delegate method splitView:shouldHideDividerAtIndex:.

    You will have to animate the frame size change yourself if you don't like the way NSSplitView does it.