Contents

CALayer

An object that manages image-based content and allows you to perform animations on that content.

Declaration

class CALayer

Overview

Layers are often used to provide the backing store for views but can also be used without a view to display content. A layer’s main job is to manage the visual content that you provide but the layer itself has visual attributes that can be set, such as a background color, border, and shadow. In addition to managing visual content, the layer also maintains information about the geometry of its content (such as its position, size, and transform) that is used to present that content onscreen. Modifying the properties of the layer is how you initiate animations on the layer’s content or geometry. A layer object encapsulates the duration and pacing of a layer and its animations by adopting the CAMediaTiming protocol, which defines the layer’s timing information.

If the layer object was created by a view, the view typically assigns itself as the layer’s delegate automatically, and you should not change that relationship. For layers you create yourself, you can assign a delegate object and use that object to provide the contents of the layer dynamically and perform other tasks. A layer may also have a layout manager object (assigned to the layoutManager property) to manage the layout of subviews separately.

Topics

Creating a layer

Accessing related layer objects

Accessing the delegate

Providing the layer’s content

Modifying the layer’s appearance

Layer filters

Configuring the layer’s rendering behavior

Modifying the layer geometry

Managing the layer’s transform

Managing the layer hierarchy

Updating layer display

Layer animations

Managing layer resizing and layout

Managing layer constraints

Getting the layer’s actions

Mapping between coordinate and time spaces

Hit testing

Scrolling

Identifying the layer

Key-value coding extensions

High dynamic range

Constants

Instance properties

Type methods

Initializers

Instance Properties

See Also

Layer Basics