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! –