Creating menu without .nib

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSApplication *app = [NSApplication sharedApplication];
// Create the main menu that will house each real menu
// File, Edit, etc.
NSMenu *menu = [[NSMenu alloc] initWithTitle:@""];
[app setMainMenu:menu];
// Create the file menu.
NSMenuItem *item = [[[NSMenuItem alloc] initWithTitle:@"" action:nil
keyEquivalent:@""] autorelease];
[item setSubmenu:[[[NSMenu alloc] initWithTitle:@"File"] autorelease]];
[menu addItem:item];
// Run the app
[app run];
return 0;
}