How to make an NSToolbar shortcut with it Icon when both are visible

My application has NSToolbara horizontal NSSplitViewunder it. NSSegmentedControlthe toolbar moves with a splitview separator, just like in OS X Finder. NSLayoutGuide was used to align two β€œviews” from different scenes in scenarios. I shared this approach in this matter.

However, I do not know how to transfer the shortcut using the icon. I installed minSizeand maxSize, but the label is fixed. In the first screenshot below, the label "View Mode" is not lower than the segmental control.

It will be easy to add restrictions to the tag if I can access it. But I did not find the API in NSToolbarItem , which only has a public property view. I am considering a presentation hierarchy (second screenshot), but I don’t think I should use variables with a prefix _.

A related but different question here . This issue does not take into account.

problem: label not below icons

presentation hierarchy

0
source share
1 answer

You can try to subclass NSToolbar with the title setting to @ "", and then create your own UILabel and add it as a preview? then you can reference its property name and move it wherever you like

0

Source: https://habr.com/ru/post/1542784/


All Articles