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 and returns a continuous horizontal slider whose values range from 0.0 to 1.0.

+ sliderWithValue:minValue:maxValue:target:action:

Creates and returns 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.

altIncrementValue

The amount by which the receiver 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.

Asking About the Value Limits

maxValue

The maximum value the receiver can send to its target.

minValue

The minimum value the receiver can send to its target.

Handling Mouse-Down Events

- acceptsFirstMouse:

Returns a Boolean value indicating whether the slider accepts a single mouse-down event that simultaneously activates the window and takes hold of the slider’s knob.

Managing Tick Marks

allowsTickMarkValuesOnly

A Boolean value that indicates whether the receiver 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 receiver represented by the given point.

numberOfTickMarks

The number of tick marks associated with the receiver.

- rectOfTickMarkAtIndex:

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

tickMarkPosition

Determines how the receiver’s tick marks are aligned with it.

- tickMarkValueAtIndex:

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

Managing the Slider’s Image

- setImage:

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

Deprecated
- image

Returns nil.

Deprecated

Managing the Slider’s Title

- title

Returns the receiver’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 receiver displays in the bar behind its knob.

Deprecated
- setTitleCell:

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

Deprecated
- setTitleColor:

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

Deprecated
- setTitleFont:

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

Deprecated

Instance Properties

trackFillColor

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

Instance Methods

Relationships

Inherits From