Before understanding CALayer, You Need To Know What layer is.
The middle layer of IOS development is a very important concept. You can find the layer component in the subclass of UIView. The layer is a child film located on a fixed canvas and can be overwritten. Layers are stacked together to generate an interface. This layer can contain multiple layers. You can operate other content on this layer, such as rotation, animation, and page flip.
However, if you want to access the layer attribute of the UIView class: CALayer * layer = myUIView. layer;
UIView has a root layer, and the final picture is displayed on the screen through the layer, and all the UIView subclass objects inherit this attribute. Layers can be understood in this simple way. For example, the following layer is the image background, and the above layer is the animation.
CALayer affects its appearance: layer size and background color
Whether the content uses rounded corner or shadow
And so on.