Class

NSSlider

A display of a bar representing a continuous range of numerical values and a knob representing the currently selected value.

Declaration

@interface NSSlider : NSControl

Overview

A slider is a UI element that displays a range of values in the app. Sliders can be vertical or horizontal bars or circular dials. An indicator, or knob, notes the current setting. The user can move the knob in the slider’s bar—or rotate the knob in a circular slider—to change the setting.

The NSSlider class uses the NSSliderCell class to implement its user interface.

Topics

Creating Sliders

+ sliderWithTarget:action:

Creates a continuous horizontal slider whose values range from 0.0 to 1.0.

+ sliderWithValue:minValue:maxValue:target:action:

Creates a continuous horizontal slider that represents values over the specified range.

Managing the Slider’s Appearance

sliderType

The type of the slider, such as vertical or circular.

NSSliderType

The types of sliders, used by sliderType.

altIncrementValue

The amount by which the slider changes its value when the user Option-drags the slider knob.

knobThickness

The knob’s thickness, in pixels.

vertical

An integer indicating the orientation (horizontal or vertical) of the slider.

trackFillColor

The color of the filled portion of the slider track, in appearances that support it.

Asking About the Value Limits

maxValue

The maximum value the slider can send to its target.

minValue

The minimum value the slider can send to its target.

Handling Mouse-Down Events

- acceptsFirstMouse:

Returns a Boolean value indicating whether a mouse-down event both activates the window and starts dragging the slider's knob.

Managing Tick Marks

allowsTickMarkValuesOnly

A Boolean value that indicates whether the slider fixes its values to those values represented by its tick marks.

- closestTickMarkValueToValue:

Returns the value of the tick mark closest to the specified value.

- indexOfTickMarkAtPoint:

Returns the index of the tick mark closest to the location of the slider represented by the given point.

numberOfTickMarks

The number of tick marks associated with the slider.

- rectOfTickMarkAtIndex:

Returns the bounding rectangle of the tick mark at the given index.

tickMarkPosition

Determines where the slider’s tick marks are displayed.

NSTickMarkPosition

The position where a linear slider’s tick marks appear (above, below, leading, or trailing).

- tickMarkValueAtIndex:

Returns the slider’s value represented by the tick mark at the specified index.

Managing the Slider’s Image

- setImage:

Sets the image the slider displays in the bar behind its knob.

Deprecated
- image

Returns nil.

Deprecated

Managing the Slider’s Title

- title

Returns the slider’s title.

Deprecated
- titleCell

This method has been deprecated. Returns nil.

Deprecated
- titleColor

This method has been deprecated. Returns nil.

Deprecated
- titleFont

This method has been deprecated. Returns nil.

Deprecated
- setTitle:

Sets the title the slider displays in the bar behind its knob.

Deprecated
- setTitleCell:

Sets the cell used to draw the slider’s title.

Deprecated
- setTitleColor:

Sets the color used to draw the slider’s title.

Deprecated
- setTitleFont:

Sets the font used to draw the slider’s title.

Deprecated

Relationships

Inherits From