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

# NSRulerMarker

A symbol on a ruler view, indicating a location for the graphics element it represents in the client of the ruler view.

```
class NSRulerMarker
```

## Overview

An example of a marker is the representation of a margin or tab setting, or the edges of a graphic on the page.

## Topics

### Creating instances

[`init(rulerView:markerLocation:image:imageOrigin:)`](/documentation/AppKit/NSRulerMarker/init(rulerView:markerLocation:image:imageOrigin:))

Initializes a newly allocated ruler marker, associating it with (but not adding it to) a specified ruler view and assigning the attributes provided.

### Getting the ruler view

[`ruler`](/documentation/AppKit/NSRulerMarker/ruler)

The receiver’s ruler view.

### Setting the image

[`image`](/documentation/AppKit/NSRulerMarker/image)

The receiver’s image.

[`imageOrigin`](/documentation/AppKit/NSRulerMarker/imageOrigin)

The point in the receiver’s image that is positioned at the receiver’s location on the ruler view.

[`imageRectInRuler`](/documentation/AppKit/NSRulerMarker/imageRectInRuler)

The rectangle occupied by the receiver’s image.

[`thicknessRequiredInRuler`](/documentation/AppKit/NSRulerMarker/thicknessRequiredInRuler)

The amount of the receiver’s image that’s displayed above or to the left of the ruler view’s baseline.

### Setting movability

[`isMovable`](/documentation/AppKit/NSRulerMarker/isMovable)

A Boolean that indicates whether the user can move the receiver in its ruler view.

[`isRemovable`](/documentation/AppKit/NSRulerMarker/isRemovable)

A Boolean that indicates whether the user can remove the receiver from its ruler view.

### Setting the location

[`markerLocation`](/documentation/AppKit/NSRulerMarker/markerLocation)

The location of the receiver in the coordinate system of the ruler view’s client view.

### Setting the represented object

[`representedObject`](/documentation/AppKit/NSRulerMarker/representedObject)

The object the receiver represents.

### Drawing and event handling

[`draw(_:)`](/documentation/AppKit/NSRulerMarker/draw(_:))

Draws the receiver’s image that appears in the supplied rectangle.

[`isDragging`](/documentation/AppKit/NSRulerMarker/isDragging)

A Boolean that indicates whether the receiver is being dragged.

[`trackMouse(with:adding:)`](/documentation/AppKit/NSRulerMarker/trackMouse(with:adding:))

Handles user manipulation of the receiver in its ruler view.

### Initializers

[`init(coder:)`](/documentation/AppKit/NSRulerMarker/init(coder:))



---

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)