<!--
{
  "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()

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

```
func drawKnob()
```

## Discussion

Before this message is sent, a `lockFocus` method must be sent to the cell’s control view.

You might call this method if you override one of the display methods belonging to `NSControl` or `NSCell`.

### Special Considerations

If you create a subclass of `NSSliderCell`, don’t override this method. Override [`drawKnob(_:)`](/documentation/AppKit/NSSliderCell/drawKnob(_:)) instead.

---

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)