Cocoa change main menu
Hi,
I'm trying to learn Cocoa Objective-C and, like any newbie, started to dissect the basic application that XCode builds up for you. Unfortunately I've spent 1 day and a half trying to figure out how the menu is "bind" to the application. Basically, I try to delete the main menu created by xcode and add/bind my custom menu. Like I said, I've failed miserably...
Any hint?
Tx
Use Interface Builder. :)
NSApplication has a method:
-(void)setMainMenu:(NSMenu *)aMenu.
You can pass it a reference to the correct menu in the appropriate window controller, by implementing
-(void)windowDidBecomeKey:(NSNotification *)notification.
Keep in mind it may be easier to change just the submenus instead of swapping out the entire main menu, since you won't have to maintain two different copies of the application, help, and other menus that won't change between the two windows.