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 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.

翻译:CALayer类管理以图片为基准的内容并且允许你去在内容上展示动画.图层面板(Layers)通常用来提供后台存储视图并且也可以不通过视图展示内容.图层面板(Layer)的主要工作是去管理那些你提供的可视的内容,但图层自身可以设置可视化属性,例如背景颜色,边界和阴影.为了管理可视化内容,图层也保留内容的几何形状信息(例如位置,尺寸,和形变)用来在屏幕上显现内容.修改图层的属性在于怎样启动图层内容或几何形状的动画.一个图层对象通过采用CAMediaTiming协议,该协议定义了图层的定时信息并且封装了图层的持续时间和调步以及动画.如果图层对象通过视图创建,视图通常自动分配自身作为图层的代理人并且你不应该改变这种关系.对于自己创建的图层,你可以指定一个委托对象,并使用该对象来动态地提供图层的内容以及执行其他任务。图层也可以有布局管理对象(指定布局管理属性)去分别管理子视图的布局.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 一天之内,印象最深刻: 出门遇到的第一个大叔,每天认真的记录违规车辆,他鼻梁上的眼镜,每每都想让我扶正。 然后第一...
    木易有心阅读 3,081评论 0 2
  • 你在外地打工, 她在家乡上班。 你在外地写诗, 她在家乡绘画。
    小剧在成长阅读 1,166评论 2 4
  • 坚持了两天没给孩子手机,昨天晚上他有点反复,回家就问他爸爸要手机。说要找他的小老师有事,给了他手机。他开始写阅读笔...
    kitcui阅读 1,265评论 0 1
  • 很喜欢画画,之前一直没机会,偶然在简书上看到铃铛子老师的训练营,想了好久才报名的!可惜还是错过了前两期,本次作业...
    来自远方的猪阅读 2,394评论 10 3

友情链接更多精彩内容