Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 右键单击和左键单击菜单栏应用程序_Objective C_Menu_Menubar_Right Click - Fatal编程技术网

Objective c 右键单击和左键单击菜单栏应用程序

Objective c 右键单击和左键单击菜单栏应用程序,objective-c,menu,menubar,right-click,Objective C,Menu,Menubar,Right Click,我有这个菜单栏应用程序,它是用来执行一个行动时,它是左键点击,并显示菜单时,它是右键点击。唯一的问题是我不知道怎么做。有人能帮我吗? 这是我用于启用菜单栏应用程序的代码: - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { // Insert code here to initialize your application [_aboutWindow orderOut:nil]; } -

我有这个菜单栏应用程序,它是用来执行一个行动时,它是左键点击,并显示菜单时,它是右键点击。唯一的问题是我不知道怎么做。有人能帮我吗? 这是我用于启用菜单栏应用程序的代码:

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
    // Insert code here to initialize your application
    [_aboutWindow orderOut:nil];
}

- (void)awakeFromNib{

    statusItem = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength] retain];

    NSBundle *bundle = [NSBundle mainBundle];

    statusImage = [[NSImage alloc] initWithContentsOfFile:[bundle pathForResource:@"icon" ofType:@"png"]];
    statusHighlightImage = [[NSImage alloc] initWithContentsOfFile:[bundle pathForResource:@"hicon" ofType:@"png"]];

    [statusItem setImage:statusImage];
    [statusItem setAlternateImage:statusHighlightImage];
    [statusItem setMenu:statusMenu];
    [statusItem setHighlightMode:YES];
}

-(void)dealloc{

    [statusImage release];
    [super dealloc];
}

欢迎来到SO!如果你说‘我想要这个’,我们很难回答,因为答案太宽泛了。相反,描述一下你目前遇到的问题,或者什么问题不起作用。我问你怎么做,因为我不知道怎么做。