https://developer.apple.com/reference/quartzcore/calayer
The CALayer class manages image-based content and allows you to perform animations on that content.Layers are often used to provide the backing store for views but can also be used without a view to displaycontent. 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 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.
CALayer类用于管理基于图像的内容并且允许在内容上执行动画。Layers经常用做view的backing store,但是没有view也可以展示内容。layer的主要管理使用者提供的可是内容,layer本身是拥有可以设置的可视属性,如背景色、边框和阴影。除了管理可视内容,layer也用于维护其内容的几何形状(如位置,大小和变换)的信息,这些信息用于固定内容在屏幕上展示形式。Layer对象通过遵守CAMediaTiming协议包括了layer的持续时间、步调以及动画,CAMediaTiming协议定义了layer的时间信息。
OverView
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.
如果layer对象由view创建,那么通常view会将它本省作为layer的delegate,使用者不应该改变这种关系。对于使用者自己创建的layer,使用者可以赋值delegate对象,并使用所赋值的对象来动态的提供layer内容以及执行其他的任务。一个 layer也许会使用布局管理对象(赋值给layoutManager属性)来单独管理子视图的布局。