/ Published in: Objective C
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
NSStatusItem *trayItem; } @end @implementation Tray - (IBAction)testAction:(id)sender; { NSLog(@"Hello World"); } - (IBAction)quitAction:(id)sender; { [NSApp terminate:sender]; } { NSMenuItem *item; item = [menu addItemWithTitle:@"Testing" action:@selector(testAction:) keyEquivalent:@""]; [item setTarget:self]; item = [menu addItemWithTitle:@"Quit" action:@selector(quitAction:) keyEquivalent:@""]; [item setTarget:self]; [trayItem setMenu:menu]; [trayItem setHighlightMode:YES]; [trayItem setTitle:@"HERE"]; } - (void)dealloc; { [trayItem release]; [super dealloc]; } @end