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

# moveRulerline(fromLocation:toLocation:)

Draws temporary lines in the ruler area.

```
func moveRulerline(fromLocation oldLocation: CGFloat, toLocation newLocation: CGFloat)
```

## Discussion

If `oldLoc` is 0 or greater, erases the ruler line at that location; if `newLoc` is 0 or greater, draws a new rulerline at that location. `oldLoc` and `newLoc` are expressed in the coordinate system of the NSRulerView, not the client or document view, and are x coordinates for horizontal rulers and y coordinates for vertical rulers. Use NSView’s `convert...` methods to convert coordinates from the client or document view’s coordinate system to that of the NSRulerView.

This method is useful for drawing highlight lines in the ruler to show the position or extent of an object while it’s being dragged in the client view. The sender is responsible for keeping track of the number and positions of temporary lines—the NSRulerView only does the drawing.

---

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)