Instance Method

translateRectsNeedingDisplayInRect:by:

Translates the display rectangles by the specified delta.

Declaration

- (void)translateRectsNeedingDisplayInRect:(NSRect)clipRect by:(NSSize)delta;

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 scrollRect: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. 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

- setNeedsDisplayInRect:

Marks the region of the view within the specified rectangle as needing display, increasing the view’s existing invalid region to include it.

needsDisplay

A Boolean value that determines whether the view needs to be redrawn before being displayed.

- display

Displays the view and all its subviews if possible, invoking each of the NSView methods lockFocus, drawRect:, and unlockFocus as necessary.

- displayRect:

Acts as display, but confining drawing to a rectangular region of the view.

- displayRectIgnoringOpacity:

Displays the view but confines drawing to a specified region and does not back up to the first opaque ancestor—it simply causes the view and its descendants to execute their drawing code.

- displayRectIgnoringOpacity:inContext:

Causes the view and its descendants to be redrawn to the specified graphics context.

- displayIfNeeded

Displays the view and all its subviews if any part of the view has been marked as needing display.

- displayIfNeededInRect:

Acts as displayIfNeeded, confining drawing to a specified region of the view.

- displayIfNeededIgnoringOpacity

Acts as displayIfNeeded, except that this method doesn’t back up to the first opaque ancestor—it simply causes the view and its descendants to execute their drawing code.

- displayIfNeededInRectIgnoringOpacity:

Acts as displayIfNeeded, but confining drawing to aRect and not backing up to the first opaque ancestor—it simply causes the view and its descendants to execute their drawing code.

opaque

A Boolean value indicating whether the view fills its frame rectangle with opaque content.

- viewWillDraw

Informs the view that it will be required to draw content.