The NSMenu Class is the basis for all Cocoa menus. It manages a collection of NSMenuItem instances. It also handles the management of a borderless window used to display the menu. Because the NSMenu object acts as a collection containing several menu items, most of its methods are for manipulating a list of menu items. Aside from variations in the names, these methods are very similar to the methods defined by NSMutableArray.
Because both the NSMenu and the NSMenuItem classes are nearly always used together, this section explains the NSMenu methods but does not provide specific code examples. Instead, the “NSMenuItem Class” section later in this chapter provides example code showing how both classes are used. You need to first ...