---
title: NSScroller
framework: appkit
role: symbol
role_heading: Class
path: appkit/nsscroller
---

# NSScroller

An object that controls scrolling of a document view within a scroll view or other type of container view.

## Declaration

```swift
class NSScroller
```

## Overview

Overview A scroller displays a slot containing a knob that the user can drag directly to the desired location. The knob indicates both the position within the document view and—by varying in size within the slot—the amount visible relative to the size of the document view. Typically, you don’t need to program with scrollers; instead, you configure them with an NSScrollView object in a Nib file. Don’t use an scroller when a slider would be more appropriate. An NSSlider object represents a range of values for something in the application and lets the user choose a setting. A scroller represents the relative position of the visible portion of a view and lets the user choose which portion to view.

## Topics

### Determining Scroller Size

- [scrollerWidth(for:scrollerStyle:)](appkit/nsscroller/scrollerwidth(for:scrollerstyle:).md)
- [controlSize](appkit/nsscroller/controlsize.md)

### Laying out a Scroller

- [arrowsPosition](appkit/nsscroller/arrowsposition.md)

### Setting the Knob Position

- [knobProportion](appkit/nsscroller/knobproportion.md)

### Calculating Layout

- [rect(for:)](appkit/nsscroller/rect(for:).md)
- [testPart(_:)](appkit/nsscroller/testpart(_:).md)
- [checkSpaceForParts()](appkit/nsscroller/checkspaceforparts().md)
- [usableParts](appkit/nsscroller/usableparts-swift.property.md)

### Drawing Scroller Parts

- [drawArrow(_:highlight:)](appkit/nsscroller/drawarrow(_:highlight:).md)
- [drawKnobSlot(in:highlight:)](appkit/nsscroller/drawknobslot(in:highlight:).md)
- [drawKnob()](appkit/nsscroller/drawknob().md)
- [highlight(_:)](appkit/nsscroller/highlight(_:).md)

### Event Handling

- [hitPart](appkit/nsscroller/hitpart.md)
- [trackKnob(with:)](appkit/nsscroller/trackknob(with:).md)
- [trackScrollButtons(with:)](appkit/nsscroller/trackscrollbuttons(with:).md)

### Setting Control Tint

- [controlTint](appkit/nsscroller/controltint.md)

### Managing Presentation Style

- [preferredScrollerStyle](appkit/nsscroller/preferredscrollerstyle.md)
- [scrollerStyle](appkit/nsscroller/scrollerstyle.md)
- [knobStyle](appkit/nsscroller/knobstyle-swift.property.md)

### Constants

- [NSScroller.Style](appkit/nsscroller/style.md)
- [NSScroller.KnobStyle](appkit/nsscroller/knobstyle-swift.enum.md)
- [NSScroller.Part](appkit/nsscroller/part.md)
- [NSScroller.Arrow](appkit/nsscroller/arrow.md)
- [NSScroller.ArrowPosition](appkit/nsscroller/arrowposition.md)
- [NSScroller.UsableParts](appkit/nsscroller/usableparts-swift.enum.md)

### Notifications

- [preferredScrollerStyleDidChangeNotification](appkit/nsscroller/preferredscrollerstyledidchangenotification.md)

### Instance Properties

- [knobProportion](appkit/nsscroller/knobproportion.md)

### Type Properties

- [isCompatibleWithOverlayScrollers](appkit/nsscroller/iscompatiblewithoverlayscrollers.md)

### Structures

- [NSScroller.PreferredScrollerStyleDidChangeMessage](appkit/nsscroller/preferredscrollerstyledidchangemessage.md)

## Relationships

### Inherits From

- [NSControl](appkit/nscontrol.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSAccessibilityElementProtocol](appkit/nsaccessibilityelementprotocol.md)
- [NSAccessibilityProtocol](appkit/nsaccessibilityprotocol.md)
- [NSAnimatablePropertyContainer](appkit/nsanimatablepropertycontainer.md)
- [NSAppearanceCustomization](appkit/nsappearancecustomization.md)
- [NSCoding](foundation/nscoding.md)
- [NSDraggingDestination](appkit/nsdraggingdestination.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSStandardKeyBindingResponding](appkit/nsstandardkeybindingresponding.md)
- [NSTouchBarProvider](appkit/nstouchbarprovider.md)
- [NSUserActivityRestoring](appkit/nsuseractivityrestoring.md)
- [NSUserInterfaceItemIdentification](appkit/nsuserinterfaceitemidentification.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Views

- [NSScrollView](appkit/nsscrollview.md)
- [NSClipView](appkit/nsclipview.md)
