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

# drawKnob(_:)

Draws the slider knob in the given rectangle.

```
func drawKnob(_ knobRect: NSRect)
```

## Parameters

`knobRect`

The rectangle in which to draw the slider knob.

## Discussion

Before this message is sent, a [`lockFocus()`](/documentation/AppKit/NSView/lockFocus()) message must be sent to the cell’s control view.

You should not call this method explicitly. It’s included so you can override it in a subclass.

---

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)