问题
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.
- The first flexible space is detected and moved along with first split view item.
- The second flexible space is detected and moved along with the second split item.
- The rest will be just normal flexible spaces.
- If there only two flexible spaces, the second will act as normal flexible space. The same thing applies to one and or flexible space.
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)
来源:https://stackoverflow.com/questions/39625942/nstoolbarflexiblespaceitem-is-constraint-to-nssplitviewitem-in-swift