---
title: "translateRectsNeedingDisplay(in:by:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsview/translaterectsneedingdisplay(in:by:)"
---

# translateRectsNeedingDisplay(in:by:)

Translates the display rectangles by the specified delta.

## Declaration

```swift
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

Discussion This method performs the shifting of dirty rectangles that an equivalent 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: Collects the receiving view’s dirty rectangles. Clears all dirty rectangles in the intersection of clipRect and the view’s bounds. Shifts the retrieved rectangles by the delta offset. Clips the result to the intersection of clipRect and the view’s bounds Marks the resultant rectangles as needing display. The developer must ensure that clipRect and delta are pixel-aligned in order to guarantee correct drawing. See Transforming View Coordinates To and From Base Space for a description of how to pixel-align view coordinates.

## See Also

### Invalidating the View’s Content

- [setNeedsDisplay(_:)](appkit/nsview/setneedsdisplay(_:).md)
- [needsDisplay](appkit/nsview/needsdisplay.md)
- [display()](appkit/nsview/display().md)
- [display(_:)](appkit/nsview/display(_:).md)
- [displayIgnoringOpacity(_:)](appkit/nsview/displayignoringopacity(_:).md)
- [displayIgnoringOpacity(_:in:)](appkit/nsview/displayignoringopacity(_:in:).md)
- [displayIfNeeded()](appkit/nsview/displayifneeded().md)
- [displayIfNeeded(_:)](appkit/nsview/displayifneeded(_:).md)
- [displayIfNeededIgnoringOpacity()](appkit/nsview/displayifneededignoringopacity().md)
- [displayIfNeededIgnoringOpacity(_:)](appkit/nsview/displayifneededignoringopacity(_:).md)
- [isOpaque](appkit/nsview/isopaque.md)
- [viewWillDraw()](appkit/nsview/viewwilldraw().md)
