Я работаю над приложением, используя NSStatusItem.
У меня две проблемы: 1 значок отсутствует в невыбранном состоянии,
Однако, когда вы щелкаете там, где должен быть значок, приложение появляется, но область большая. Тот же размер, что и меню.
Вот как я создаю NSStatusItem и меню.
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
_statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];
_statusItem.title = @"";
_statusItem.image = [NSImage imageNamed:@"bulb"];
_statusItem.alternateImage = [NSImage imageNamed:@"bulb-alt"];
_statusItem.highlightMode = YES;
NSMenu *menu = [[NSMenu alloc] init];
[menu addItemWithTitle:@"About App" action:@selector(openAboutThisImage:) keyEquivalent:@""];
[menu addItem:[NSMenuItem separatorItem]]; // A thin grey line
[menu addItemWithTitle:@"Start at Login" action:@selector(startAtLogin:) keyEquivalent:@""];
[menu addItem:[NSMenuItem separatorItem]]; // A thin grey line
[menu addItemWithTitle:@"Quit App" action:@selector(terminate:) keyEquivalent:@""];
_statusItem.menu = menu;
}
У меня есть два набора иконок. Один белый и один черный. Каждый набор имеет два размера 16x16 и 32x32 (@2x).
Размеры иконок:
Белые одинаковые по размеру.
Актив JSON для ЧЕРНОЙ иконки
{
"images" : [
{
"idiom" : "universal",
"filename" : "bulb.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
и белый значок
{
"images" : [
{
"idiom" : "universal",
"filename" : "bulb-alt.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Я действительно в недоумении от того, что происходит. Я использовал Apple Docs в качестве справки. Но я явно что-то упускаю.
Любая помощь?