Enumeration

NSView.LayerContentsRedrawPolicy

Constants that specify how layer resizing is handled when a view is layer-backed or layer-hosting. For more information, see the layerContentsRedrawPolicy property.

Declaration

enum LayerContentsRedrawPolicy : Int

Topics

Constants

case never

Leave the layer's contents alone. Never mark the layer as needing display, or draw the view's contents to the layer. This is how developer created layers (layer-hosting views) are treated.

case onSetNeedsDisplay

Any of the setNeedsDisplay methods sent to the view will cause the view redraw the affected layer parts by invoking the view's draw(_:), but neither the layer or the view are marked as needing display when the view's size changes.

case duringViewResize

Resize the view’s backing-layer and redraw the view to the layer when the view's size changes. If the resize is animated, AppKit will drive the resize animation itself and will do this resize and redraw at each step of the animation. Affected parts of the layer will also be redrawn when the view is marked as needing display. This mode is a superset of NSView.LayerContentsRedrawPolicy.onSetNeedsDisplay. This is the way that layer-backed views are currently treated.

case beforeViewResize

Resize the layer and redraw the view to the layer when the view's size changes. This will be done just once at the beginning of a resize animation, not at each frame of the animation. Affected parts of the layer will also be redrawn when the view is marked as needing display. This mode is a superset of NSView.LayerContentsRedrawPolicy.onSetNeedsDisplay.

case crossfade

Redraw the layer contents at the new size and crossfade from the old contents to the new contents. Use this in conjunction with the NSView.LayerContentsPlacement constants to get a nice crossfade animation for complex layer-backed views that cannot update correctly at each step of the animation.