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

# translateRectsNeedingDisplay(in:by:)

Translates the display rectangles by the specified delta.

```
func translateRectsNeedingDisplay(in clipRect: NSRect, by delta: NSSize)
```

## Parameters

`clipRect`

A rectangle defining the region of the view, typically the view’s bounds.

`delta`

A NSSize structure that specifies an offset from aRect’s origin.

## Discussion

This method performs the shifting of dirty rectangles that an equivalent [`scroll(_:by:)`](/documentation/AppKit/NSView/scroll(_:by:)) operation would cause, without performing the actual scroll operation.  It is only useful in very rare cases where a view implements its own low-level scrolling mechanics.

This method:

1. Collects the receiving view’s dirty rectangles.
2. Clears all dirty rectangles in the intersection of `clipRect` and the view’s bounds.
3. Shifts the retrieved rectangles by the `delta` offset.
4. Clips the result to the intersection of `clipRect` and the view’s bounds
5. Marks the resultant rectangles as needing display.

The developer must ensure that `clipRect` and `delta` are pixel-aligned in order to guarantee correct 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)