所以我有一个关于
我看到了这个问题:在cocoa状态应用程序中显示图像,但问题仍然存在,所以我不确定还能做什么,感谢任何帮助!PS:我认为问题出在
NSStatusBar
项目图像的问题,似乎图像在菜单中推开了其他项目,如您在此图片中所见。 但是当菜单栏处于非活动状态时(例如,我在另一个显示器上或未打开该应用程序),问题不会发生如您在此图片中所见。 尽管如此,我相信我的代码是正确的。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"]];
}
我看到了这个问题:在cocoa状态应用程序中显示图像,但问题仍然存在,所以我不确定还能做什么,感谢任何帮助!PS:我认为问题出在
NSVariableStatusItemLength
上,我尝试了NSSquareStatusItemLength
,但没有成功,也尝试了手动设置它,但是问题依旧存在,只有一点改进。