This protocol defines an optional
CALayer delegate method for handling resolution changes, allowing you to manage scale and contents for a layer hosted in a view.
When a window changes its backing resolution, AppKit attempts to automatically update the
contents of all
CALayer objects in the window to match the new resolution. Layers backed by a view are updated automatically. Any layer whose
contents property is set to an
NSImage object is also updated automatically. Based on the
NSImage object’s available representations, AppKit selects an appropriate bitmapped representation, or rasterizes a resolution-independent representation at the appropriate scale factor.
For all other layers, AppKit checks whether the layer has a delegate that implements this protocol. If so, AppKit asks the layer's delegate whether it should automatically update the
contentsScale for that layer to match the new scale factor of the window.
Invoked when a resolution changes occurs for the window that hosts the layer.
The layer whose scale and content might need updating.
The new scale of the window.
The window that hosts the layer.
A Boolean value that specifies whether to change the layer’s
When a resolution change occurs for a given window, the system traverses the layer trees in that window to decide what action, if any, to take for each layer. The system will query the layer’s delegate to determine whether to change the layer’s
contentsScaleproperty to the new scale (either
If the delegate returns
true, it should make any corresponding changes to the layer’s properties, as required by the resolution change. For example, a layer whose contents contain a CGImage object needs to determine whether an alternate CGImage object is available for the new scale factor. If the delegate finds a suitable CGImage object, then in addition to returning
true, it should set the appropriate CGImage object as the layer’s new contents.
Available in OS X v10.7 and later.