Contents

NSSegmentedControl

Display one or more buttons in a single horizontal group.

Declaration

class NSSegmentedControl

Overview

The 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.

  • Segmented controls have four tracking modes, described in NSSegmentedControl.SwitchTracking. You use these modes with the trackingMode property.

  • 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.

Topics

Creating a segmented control

Configuring the cell

Specifying the segment behavior

Specifying number of segments

Configuring the segment text

Configuring a segment image

Configuring a segment menu

Managing the selected segment

Adjusting the segment spacing

Specifying the border shape

Enabling and disabling segments

Managing tags and tooltips

See Also

Controls