Objects used to create true 3D layer hierarchies, rather than the flattened hierarchy rendering model used by other
- iOS 3.0+
- macOS 10.6+
- Mac Catalyst 13.0+Beta
- tvOS 9.0+
- Core Animation
Unlike normal layers, transform layers do not flatten their sublayers into the plane at
Z=0. Due to this, they do not support many of the features of the
CALayer class compositing model:
Only the sublayers of a transform layer are rendered. The
CALayerproperties that are rendered by a layer are ignored, including:
contents, border style properties, stroke style properties, etc.
The properties that assume 2D image processing are also ignored, including:
masks, and shadow style properties.
opacityproperty is applied to each sublayer individually, the transform layer does not form a compositing group.
hitmethod should never be called on a transform layer as they do not have a 2D coordinate space into which the point can be mapped.
Example: Displaying layers in 3D
CATransform creates true 3D layer hierarchies, you can display otherwise hidden layers when applying 3D transforms.
Listing 1 shows three differently colored but identically sized layers added at the same position to
layer. The blue layer is visible because it has the highest
z. Defining the layer's transform rotates the viewpoint in 3D space and, because
layer is a
CATransform, all three layers are visible as illustrated in Figure 1.