<!--
{
  "availability" : [
    "macOS: 10.12.2 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSScrubber/scrollItem(at:to:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSScrubber(im)scrollItemAtIndex:toAlignment:"
  },
  "title" : "scrollItem(at:to:)"
}
-->

# scrollItem(at:to:)

Scrolls an item to a specified alignment within the scrubber.

```
func scrollItem(at index: Int, to alignment: NSScrubber.Alignment)
```

## Parameters

`index`

The index of the item to be scrolled. Indexes range between `0` and `n-1`, where `n` is the number of items displayed in the scrubber.

`alignment`

The position the item should be scrolled to. For possible values, see [`NSScrubber.Alignment`](/documentation/AppKit/NSScrubber/Alignment). If [`NSScrubber.Alignment.none`](/documentation/AppKit/NSScrubber/Alignment/none), the scrubber scrolls the minimum distance required to make the item visible.

## Discussion

To animate the scroll, call this method on the animator proxy. See [`NSAnimatablePropertyContainer`](/documentation/AppKit/NSAnimatablePropertyContainer) for details.

---

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)