Instance Method

updateLayer

Updates the view’s content by modifying its underlying layer.

Declaration

- (void)updateLayer;

Discussion

You use this method to optimize the rendering of your view in situations where you can represent your views contents entirely using a layer object. If your view’s wantsUpdateLayer property is YES, the view calls this method instead of drawRect: during the view update cycle. Custom views can override this method and use it to modify the properties of the underlying layer object. Modifying layer properties is a much more efficient way to update your view than is redrawing its content each time something changes.

When you want to update the contents of your layer, mark the view as dirty by setting its needsDisplay property to YES. Doing so adds the view to the list of views that need to be refreshed during the next update cycle. During that update cycle, this method is called if thewantsUpdateLayer property is still YES.

Your implementation of this method should not call super.

See Also

Drawing

- drawRect:

Overridden by subclasses to draw the view’s image within the specified rectangle.

canDraw

A Boolean value indicating whether drawing commands will produce any results.

Deprecated
canDrawConcurrently

A Boolean value indicating whether the view can draw its contents on a background thread.

visibleRect

The portion of the view that is not clipped by its superviews.

- getRectsBeingDrawn:count:

Returns by indirection a list of nonoverlapping rectangles that define the area the view is being asked to draw in drawRect:.

- needsToDrawRect:

Returns a Boolean value indicating whether the specified rectangle intersects any part of the area that the view is being asked to draw.

wantsDefaultClipping

A Boolean value indicating whether AppKit’s default clipping behavior is in effect.

- bitmapImageRepForCachingDisplayInRect:

Returns a bitmap-representation object suitable for caching the specified portion of the view.

- cacheDisplayInRect:toBitmapImageRep:

Draws the specified area of the view, and its descendants, into a provided bitmap-representation object.