NSSegmentedControl object implements a linear set of two or more segments, each of which functions as a button.
- macOS 10.10+
NSSegmentedControl class uses an
NSSegmentedCell class to implement much of the control's functionality. Most methods in
NSSegmentedControl are simply cover methods that call the corresponding method in
NSSegmentedCell. The methods of
NSSegmentedCell that do not have covers relate to accessing and setting values for tags and tooltips, programatically setting the key segment, and establishing the mode of the control.
The features of a segmented control include the following:
A segment can have an image, text (label), menu, tooltip, and tag.
A segmented control can contain images or text, but not both.
Either the control or individual segments can be enabled or disabled.
Each segment can be either a fixed width or autosized to fit the contents.
If a segment has text and is marked as autosizing, then the text may be truncated so that the control completely fits.
If an image is too large to fit in a segment, it is clipped.
If Full Keyboard Access is enabled in System Preferences > Keyboard, the keyboard may be used to move between and select segments.