Almost all macOS official apps have this toolbar's feature which the NSToolbarItem
flexible space is constraint to NSSplitViewItem
view. I first thought maybe there are 3 different sections on NSToolbar. But it just ONE toolbar. You can open Notes app and customize the toolbar.
I guess this is how Apple configure the flexible space items.
I found this JWToolbarAdaptiveSpaceItem but it's removable and it cannot be replaced with flexible space item like Note apps does.
There is another stackoverflow's question (I couldn't find it now) asked about this but the answer is adding fake views and buttons which is not NSToolbar.
Thus, does anyone know how to achieve this?
(Sorry about my English)
As of macOS 11 Big Sur, this is handled by NSTrackingSeparatorToolbarItem
, which interacts with the dividers of an NSSplitView
. There is also a new navigational
property on NSToolbarItem
that can influence item locations.
I do not think there is a built-in way to do this on previous macOS versions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With