2
所以我有一个NSStatusBar
项目的图像的问题,它似乎像图像推开了其余的菜单项as you can see in this picture.但是,当菜单栏不活动(如在我为我的其他显示器上或者没有在应用程序)的问题不会发生as you can see in this picture。我很确定我的代码是正确的。OSX状态栏图像大小 - 可可
statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];
[statusItem setHighlightMode:YES];
[statusItem setAction:@selector(openWindow)];
[statusItem setTarget:self];
if ([[[NSAppearance currentAppearance] name] containsString:NSAppearanceNameVibrantDark]) {
[statusItem setImage:[NSImage imageNamed:@"whiteMenu.png"]];
} else {
[statusItem setImage:[NSImage imageNamed:@"blackMenu.png"]];
}
我认为这一问题:Display image in a cocoa status app,但问题仍然存在,所以我不知道自己能做什么,感谢您的帮助! PS:我认为这个问题是NSVariableStatusItemLength
,我试图NSSquareStatusItemLength
但没有运气,也尝试设置它自己,但同样的问题,但几乎没有改善。
你的答案是好多了,但事实证明,另一种答案我的问题是,只是为了摆脱这是控制状态栏的计时器,因为我曾经有过一个定时器来检查菜单栏的外观发生了变化不过谢谢!没有线索我不得不使用pdf! –