Types of Button

The button type determines how the button acts: how it highlights when pressed and whether it shows its state. The button types fall into three categories:

You set the button type with setButtonType:.

Push Buttons

These buttons are most useful for triggering actions, since they don’t show their state. They change their appearance when the mouse button is held down and return to their original appearance when the mouse button is released.

Sticky Buttons

These buttons show their state and appear to stick when pressed. After you click one, it appears to stay pressed until you click it again.

If you want a button to display different appearances for all three states, you must subclass NSButton.

Radio Buttons and Checkboxes

These buttons display the state of something in your application. They’re specialized versions of NSToggleButton that have system-defined images.

Changing the images used for these buttons could lead to unpredictable results. If you want a switch or radio button with a customized appearance, either customize a toggle button or subclass NSButton.

Although checkboxes and radio buttons can display different images for all three states, other types of buttons cannot.