Adds a button with a given title to the alert.
- macOS 10.3+
Title of the button to add to the alert. Must not be
Button added to the alert.
Buttons are placed starting near the right side of the alert and going toward the left side (for languages that read left to right). The first three buttons are identified positionally as
NSAlert in the return-code parameter evaluated by the modal delegate. Subsequent buttons are identified as
n is an integer
By default, the first button has a key equivalent of Return, any button with a title of “Cancel” has a key equivalent of Escape, and any button with the title “Don’t Save” has a key equivalent of Command-D (but only if it’s not the first button). You can also assign different key equivalents for the buttons using the
key method of the
NSButton class. In addition, you can use the
tag method of the
NSButton class to set the return value.