Connecting A Submenu In Interface Builder
The easiest way to dynamically change menus at runtime is to link the menu in the nib to a variable in your class. This is relatively easy todo if you are connecting a non-submenu item:
- Create an IBOutlet variable:
IBOutlet NSMenu *clientMenu;
- Drag the header file for the controlling class onto the nib
- Instantiate it in instances and make the connection (make connections by holding ctrl down and dragging from one object to another).
But if you want to connect to a submenu it is harder because there is not graphical representation that you can connect it to. The solution here is to use the outline mode.
To get into outline mode you will need to click the small button just ontop of the scroll bar on the right-hand side. You can return to icon mode by clicking the button next to it when you are done.
Outline mode shows all the resources in the NIB in a hierarchy. From this view you can locate the menus and expand them. When you find the submenu you should also find a component labeled NSMenu. All you have to do now is make the connection between that NSMenu and your outlet.










