Misaligned NSAttributedString in macOS NSStatusItem's button

陌路散爱 提交于 2021-02-11 15:05:01

问题


I would like to display a two-line NSAttributedString as the button title of the NSStatusItem of my macOS app.
However, it seems to move the text up a few pixels and, thus, cut it off. This problem did not occur before macOS Big Sur.

Workaround

With some effort I managed to generate an NSImage of the text and use it as the button's image.

Question

Is there any way to position the NSAttributedString correctly without using an image?

来源:https://stackoverflow.com/questions/65167179/misaligned-nsattributedstring-in-macos-nsstatusitems-button

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!