I'd like to duplicate the appearance of the menu below, with named "sections" in the pop-up button's menu.
I can tell that the grey horizontal lines are NSMenuItem.separator()
but setting the title and attributed title on those doesn't work. Adding submenus gets me nowhere, as does adding disabled menu items. This seems to be a common pattern, and I find it hard to believe that it's just ad-hoc with attributed strings / custom views everywhere.
What you need is a NSMenuItem.separator()
plus a disabled NSMenuItem to display the title. With NSMenuItem
attributedTitle
and indentationLevel
you can customise the appearance of the text. Consider that NSMenu
autoenablesItems can also have an effect.
Best, Marc