Its just that. I want to center two buttons. My toolbar looks like this ([B] is a button) :
[B] <---- flexible space ---> [B][B] <---- flexible space ---> [SearchBar]
But the search bar is bigger than the button on the far left so the middle buttons are not centered. I tried adding a view with a custom width but that is screwed up by localization. Is there a way to center them?
A very belated response but since I also needed to do this i've just written a subclass that will create a space to center the next toolbar item:
http://github.com/timothyarmes/TAAdaptiveSpaceItem
If your deployment target is macOS 10.14 (Mojave) or later, you can center a toolbar item by setting the toolbar's centeredItemIdentifier
property to the identifier of the item you want centered.
This is intended for centering the toolbar item that contains the window title when you have set the window's titleVisibility
to NSWindowTitleHidden
. It might not work as well in other scenarios.
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