Initializer

init(title:action:keyEquivalent:)

Returns an initialized instance of NSMenuItem.

Declaration

init(title string: String, action selector: Selector?, keyEquivalent charCode: String)

Parameters

itemName

The title of the menu item. This value must not be nil (if there is no title, specify an empty NSString).

anAction

The action selector to be associated with the menu item. This value must be a valid selector or NULL.

charCode

A string representing a keyboard key to be used as the key equivalent. This value must not be nil (if there is no key equivalent, specify an empty NSString).

Return Value

An instance of NSMenuItem.

Discussion

For instances of the NSMenuItem class, the default initial state is NSOffState, the default on-state image is a check mark, and the default mixed-state image is a dash.