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

# drawHashMarksAndLabels(in:)

Draws the receiver’s hash marks and labels in `aRect`, which is expressed in the receiver’s coordinate system.

```
func drawHashMarksAndLabels(in rect: NSRect)
```

## Discussion

This method is invoked by [`draw(_:)`](/documentation/AppKit/NSRulerMarker/draw(_:))—you should never need to invoke it directly. You can define custom measurement units using the class method [`registerUnit(withName:abbreviation:unitToPointsConversionFactor:stepUpCycle:stepDownCycle:)`](/documentation/AppKit/NSRulerView/registerUnit(withName:abbreviation:unitToPointsConversionFactor:stepUpCycle:stepDownCycle:)). Override this method if you want to customize the appearance of the hash marks themselves.

---

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)