Reputation: 13178
I'm trying to make an application that looks like the Messages app from Apple.
The NSSplitView
has toolbars on both subviews of the NSSplitView
. They blend in with the top toolbar. It's similar to the NSToolBar
but that doesn't work in NSSplitView
's. Is there any way to make this work?
I tried the CNSplitView
but it doesn't provide the proper effect. Is there another way of doing this that I'm missing?
The interface i'm going for is here:
Upvotes: 0
Views: 584
Reputation: 3231
Instead of using NSToolbar, you can add your own views to the top of subviews in the NSSplitView to achieve this after hiding the existing titlebar.
NSWindow's titleVisibility
can be used to hide the built-in titlebar, and by setting the window's styleMask
to include NSFullSizeContentViewWindowMask
you can cause the split view to take up the full height of the window.
To get the blur effect like toolbars/Messages you can use NSVisualEffectView in the top views. Setting the material NSVisualEffectMaterialTitlebar
will give the same look as standard titlebars.
And finally, you can put NSStackView
s inside the visual effect views, and then place the titlebar controls in there.
(And depending on the content that is below your fake toolbars, you might want to look into NSScrollView's contentInsets
property to allow the scroll view to show all of the content, but still be able to scroll under your toolbar).
Upvotes: 1