<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSSliderCell",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSSliderCell"
  },
  "title" : "NSSliderCell"
}
-->

# NSSliderCell

The appearance and behavior of an [`NSSlider`](/documentation/AppKit/NSSlider) object.

```
class NSSliderCell
```

## Overview

You can customize an [`NSSliderCell`](/documentation/AppKit/NSSliderCell) to a certain degree, using its properties. If this doesn’t give you sufficient flexibility, you can create a subclass. In that subclass, you can override any of the following methods: [`knobRect(flipped:)`](/documentation/AppKit/NSSliderCell/knobRect(flipped:)), [`drawBar(inside:flipped:)`](/documentation/AppKit/NSSliderCell/drawBar(inside:flipped:)), [`drawKnob(_:)`](/documentation/AppKit/NSSliderCell/drawKnob(_:)), and [`prefersTrackingUntilMouseUp`](/documentation/AppKit/NSSliderCell/prefersTrackingUntilMouseUp).

## Topics

### Managing Cell Behavior

[`altIncrementValue`](/documentation/AppKit/NSSliderCell/altIncrementValue)

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

[`prefersTrackingUntilMouseUp`](/documentation/AppKit/NSSliderCell/prefersTrackingUntilMouseUp)

Returns a Boolean value indicating whether the `NSSliderCell` continues to track the pointer until the next mouse up.

[`trackRect`](/documentation/AppKit/NSSliderCell/trackRect)

The rectangle within which the cell tracks the pointer while the mouse button is down.

### Managing the Slider Type

[`sliderType`](/documentation/AppKit/NSSliderCell/sliderType)

The slider type, either linear or circular.

### Displaying the Cell

[`barRect(flipped:)`](/documentation/AppKit/NSSliderCell/barRect(flipped:))

Returns the rectangle in which the bar is drawn.

[`drawTickMarks()`](/documentation/AppKit/NSSliderCell/drawTickMarks())

Draws the slider’s tick marks.

[`knobRect(flipped:)`](/documentation/AppKit/NSSliderCell/knobRect(flipped:))

Returns the rectangle in which the slider knob is drawn.

[`drawBar(inside:flipped:)`](/documentation/AppKit/NSSliderCell/drawBar(inside:flipped:))

Draws the slider’s bar—but not its bezel or knob—inside the specified rectangle.

[`drawKnob()`](/documentation/AppKit/NSSliderCell/drawKnob())

Calculates the rectangle in which the knob should be drawn, then calls [`drawKnob(_:)`](/documentation/AppKit/NSSliderCell/drawKnob(_:)) to actually draw the knob.

[`drawKnob(_:)`](/documentation/AppKit/NSSliderCell/drawKnob(_:))

Draws the slider knob in the given rectangle.

### Managing Cell Appearance

[`knobThickness`](/documentation/AppKit/NSSliderCell/knobThickness)

The thickness of the slider knob, in pixels.

[`isVertical`](/documentation/AppKit/NSSliderCell/isVertical)

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

[`title`](/documentation/AppKit/NSSliderCell/title)

Returns the slider’s title.

[`setTitle:`](/documentation/AppKit/NSSliderCell/setTitle:)

Sets the title in the bar behind the slider’s knob.

[`titleCell`](/documentation/AppKit/NSSliderCell/titleCell)

Returns `nil`.

[`setTitleCell:`](/documentation/AppKit/NSSliderCell/setTitleCell:)

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

[`titleFont`](/documentation/AppKit/NSSliderCell/titleFont)

Returns `nil`.

[`titleColor`](/documentation/AppKit/NSSliderCell/titleColor)

Returns `nil`.

[`setTitleFont:`](/documentation/AppKit/NSSliderCell/setTitleFont:)

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

[`setTitleColor:`](/documentation/AppKit/NSSliderCell/setTitleColor:)

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

### Managing Value Limits

[`maxValue`](/documentation/AppKit/NSSliderCell/maxValue)

The maximum value the slider can send to its target.

[`minValue`](/documentation/AppKit/NSSliderCell/minValue)

The minimum value the slider can send to its target.

### Managing Tick Marks

[`allowsTickMarkValuesOnly`](/documentation/AppKit/NSSliderCell/allowsTickMarkValuesOnly)

A Boolean value indicating whether the receiver fixes its values to those values represented by its tick marks.

[`closestTickMarkValue(toValue:)`](/documentation/AppKit/NSSliderCell/closestTickMarkValue(toValue:))

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

[`indexOfTickMark(at:)`](/documentation/AppKit/NSSliderCell/indexOfTickMark(at:))

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

[`numberOfTickMarks`](/documentation/AppKit/NSSliderCell/numberOfTickMarks)

The number of tick marks associated with the slider, including the tick marks assigned to the minimum and maximum values.

[`rectOfTickMark(at:)`](/documentation/AppKit/NSSliderCell/rectOfTickMark(at:))

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

[`tickMarkPosition`](/documentation/AppKit/NSSliderCell/tickMarkPosition)

The position of the tick marks relative to the receiver.

[`tickMarkValue(at:)`](/documentation/AppKit/NSSliderCell/tickMarkValue(at:))

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

### Constants

[`NSSlider.TickMarkPosition`](/documentation/AppKit/NSSlider/TickMarkPosition-swift.enum)

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

[`NSSlider.SliderType`](/documentation/AppKit/NSSlider/SliderType-swift.enum)

The types of sliders, used by [`sliderType`](/documentation/AppKit/NSSliderCell/sliderType).

### Instance Methods

[`image`](/documentation/AppKit/NSSliderCell/image)

[`setImage:`](/documentation/AppKit/NSSliderCell/setImage:)

[`setKnobThickness:`](/documentation/AppKit/NSSliderCell/setKnobThickness:)

The thickness of the slider knob, in pixels.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)