简体   繁体   English

在NSMenuItem中显示图标时不缩进

[英]No indentation when displaying an icon in an NSMenuItem

I am trying to add an icon to only one NSMenuItem item but it is indenting the icon and text by 1 level. 我试图将图标仅添加到一个NSMenuItem项,但是它会将图标和文本缩进1级。

I tried to set the setIndentationLevel to "0" but that doesn't work. 我试图将setIndentationLevel设置为“ 0”,但这不起作用。

An example of what I am trying to achieve can be seen in the Wireless status bar menu where the tickbox is displayed against the current WiFi your connected to eg http://cl.ly/2T362b2I0f1G1O3b3G3z 在无线状态栏菜单中可以看到我正在尝试实现的示例,其中选中框针对您所连接的当前WiFi显示,例如http://cl.ly/2T362b2I0f1G1O3b3G3z

Any tips are appreciated! 任何提示表示赞赏!

That check mark is the menu item's "on" state image. 该复选标记是菜单项的“打开”状态图像。 NSMenuItem includes methods for setting its state and the image displayed for each of its states. NSMenuItem包括用于设置其状态和为其每个状态显示的图像的方法。 (By default, the "on" image is that check mark, the "off" state image is blank and the "mixed" state image is a dash.) (默认情况下,“开”图像为复选标记,“关”状态图像为空白,而“混合”状态图像为破折号。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM