Lefora Free Forum
login join
Loading
132 views

Cocoa change main menu

Page 1
(items) 1–3 of 3
rookie - member
1 posts

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

rookie - member
3 posts

Use Interface Builder. :)

rookie - member
2 posts

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.

Page 1
(items) 1–3 of 3

Locked Topic


You must be a member to post in this forum

Join Now!