Instance Method

layerContentsForContentsScale:

Returns an object that may be used as the contents of a layer.

Declaration

- (id)layerContentsForContentsScale:(CGFloat)layerContentsScale;

Parameters

layerContentsScale

The scale factor for the resulting image. Obtain the value for this parameter by calling the recommendedLayerContentsScale: method.

Return Value

A object that you can assign to the contents property of a CALayer object. This object contains the image data from the current image optimized for the specified scale factor.

Discussion

Use this method in situations where you want to use the image as the contents of a layer. This method provides the image data wrapped in an object that correctly respects all of the possible content gravities supported by the layer. Use of the returned object as the layer’s contents is recommended over the use of the NSImage object itself.

See Also

Using an Image with Core Animation

- recommendedLayerContentsScale:

Returns the recommended layer contents scale for this image.