Display one or more buttons in a single horizontal group.


@interface NSSegmentedControl : NSControl


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


Configuring the Cell


An NSSegmentedCell object implements the appearance and behavior of a horizontal button divided into multiple segments. This class is used in conjunction with the NSSegmentedControl class to implement a segmented control.

Specifying the Segment Behavior


The type of tracking behavior the control exhibits.


The following constants specify the type of tracking behavior a segmented control exhibits. They are used by trackingMode.


The visual style used to display the control.


The following constants specify the visual style used to display the segmented control. They are used by segmentStyle.

Specifying Number of Segments


The number of segments in the control.

Configuring the Segment Text

- labelForSegment:

Returns the label of the specified segment.

- setLabel:forSegment:

Sets the label for the specified segment.

Configuring a Segment Image

- setImage:forSegment:

Sets the image for the specified segment.

- imageForSegment:

Returns the image associated with the specified segment.

- setImageScaling:forSegment:

Sets the scaling mode used to display the specified segment’s image.

- imageScalingForSegment:

Returns the scaling mode used to display the specified segment’s image.

Configuring a Segment Menu

- setMenu:forSegment:

Sets the menu for the specified segment.

- menuForSegment:

Returns the menu for the specified segment.


A Boolean value that indicates whether spring loading is enabled for the control.

Managing the Selected Segment


The index of the selected segment of the control, or -1 if no segment is selected.

- selectSegmentWithTag:

Selects the segment with the specified tag.

- setSelected:forSegment:

Sets the selection state of the specified segment.

- isSelectedForSegment:

Returns a Boolean value indicating whether the specified segment is selected.


The color of the selected segment's bezel, in appearances that support it.


When the tracking mode for the control is set to use a momentary accelerator, returns a value for the selected segment.

Enabling and Disabling Segments

- setEnabled:forSegment:

Sets the enabled state of the specified segment

- isEnabledForSegment:

Returns a Boolean value indicating whether the specified segment is enabled.


Inherits From

See Also



A control that defines an area on the screen that can be used to trigger actions.


A control that displays a color value and lets the user change that color value.

Date Picker

Display a calendar date and provide controls for editing the date value.


A display of image data from an NSImage object in a frame.


A visual representation of a level or quantity, using discrete values.

Path Control

A display of a file system path or virtual path information.


A control for selecting an item from a list.


An interface that provides visual feedback to the user about the status of an ongoing task.


An interface for configuring a rule-based list of options.


A defined set of rules that allows the editing of predicate objects.

Search Field

Provide a text field that is optimized for text-based search interfaces.


Display a range of values from which the user selects a single value.


An interface with up and down arrow buttons for incrementing or decrementing a value.

Text Field

Provide a simple interface for displaying and editing text, including support for password fields and secure forms of text entry.

Token Field

Provide a text field whose text can be rendered in a visually distinct way so that users can recognize portions more easily.


Provide a space for controls under a window's title bar and above your custom content.

Combo Box

Display a list of values in a pop-up menu that lets the user select a value or type in a custom value.


A legacy interface for grouping radio buttons or other types of cells together.


A control that offers a binary choice.