NSButtonCell
An object that defines the user interface of a button or other clickable region of a view.
Declaration
class NSButtonCellOverview
Setting the integer, float, double, or object value of an NSButtonCell object results in a call to state with the value converted to integer. In the case of objectValue, nil is equivalent to 0, and a non-nil object that doesn’t respond to intValue sets the state to 1. Otherwise, the state is set to the object’s intValue. Similarly, for most button types, querying the integer, float, double, or object value of an NSButtonCell returns the current state in the requested representation. In the case of objectValue, this is an NSNumber containing true for on, false for off, and integer value -1 for the mixed state. For accelerator buttons (type NSAcceleratorButton or NSMultiLevelAcceleratorButton) on systems that support pressure sensitivity, querying doubleValue returns the amount of pressure applied while pressing the button.
The configuration of an NSButtonCell object controls how the button object appears and behaves, but it’s NSButton that sends a message when the control is clicked. For more information on the behavior of NSButtonCell, see the NSButton and NSMatrix class specifications, and Button Programming Topics.
Exceptions
In its implementation of the compare(_:) method (declared in NSCell), NSButtonCell raises an NSBadComparisonException if the otherCell argument is not of the NSButtonCell class.
Fonts
Setting the font property does nothing if the button has no title or alternate title. If the button cell has a key equivalent, its font is not changed, but the key equivalent’s font size is changed to match the new title font.
Topics
Creating the Cell
Setting Titles
Managing Images
Managing the Repeat Interval
Managing the Key Equivalent
Managing Graphics Attributes
backgroundColorbezelStylegradientTypeimageDimsWhenDisabledisOpaqueisTransparentshowsBorderOnlyWhileMouseInside