zoukankan      html  css  js  c++  java
  • Layer Trees Reflect Different Aspects of the Animation State

    https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CoreAnimation_guide/CoreAnimationBasics/CoreAnimationBasics.html#//apple_ref/doc/uid/TP40004514-CH2-SW3

    Layer Trees Reflect Different Aspects of the Animation State

    An app using Core Animation has three sets of layer objects. Each set of layer objects has a different role in making the content of your app appear onscreen:

    • Objects in the model layer tree (or simply “layer tree”) are the ones your app interacts with the most. The objects in this tree are the model objects that store the target values for any animations. Whenever you change the property of a layer, you use one of these objects. 

    • Objects in the presentation tree contain the in-flight values for any running animations. Whereas the layer tree objects contain the target values for an animation, the objects in the presentation tree reflect the current values as they appear onscreen. You should never modify the objects in this tree. Instead, you use these objects to read current animation values, perhaps to create a new animation starting at those values. 

    • Objects in the render tree perform the actual animations and are private to Core Animation. 

    Each set of layer objects is organized into a hierarchical structure like the views in your app. In fact, for an app that enables layers for all of its views, the initial structure of each tree matches the structure of the view hierarchy exactly. However, an app can add additional layer objects—that is, layers not associated with a view—into the layer hierarchy as needed. You might do this in situations to optimize your app’s performance for content that does not require all the overhead of a view. Figure 1-9 shows the breakdown of layers found in a simple iOS app. The window in the example contains a content view, which itself contains a button view and two standalone layer objects. Each view has a corresponding layer object that forms part of the layer hierarchy. 

    Figure 1-9  Layers associated with a window

    For every object in the layer tree, there is a matching object in the presentation and render trees, as shown in Figure 1-10. As was previously mentioned, apps primarily work with objects in the layer tree but may at times access objects in the presentation tree. Specifically, accessing the presentationLayerproperty of an object in the layer tree returns the corresponding object in the presentation tree. You might want to access that object to read the current value of a property that is in the middle of an animation.

    Figure 1-10  The layer trees for a window

    Important: You should access objects in the presentation tree only while an animation is in flight. While an animation is in progress, the presentation tree contains the layer values as they appear onscreen at that instant. This behavior differs from the layer tree, which always reflects the last value set by your code and is equivalent to the final state of the animation.

  • 相关阅读:
    mac下配置Node.js开发环境、express安装、创建项目
    基于bootstrap模态框的二次封装
    生成二维码、微信自定义分享到朋友圈、ipa不从应用商店安装
    浏览器设备判断
    微信浏览中的下载自动被拦截,加遮罩在浏览其中打开
    css:图标与文字对齐的两种方法
    js获取当前域名
    JS动态修改微信浏览器中的title
    UWP 播放直播流 3MU8
    vb6 读写文件
  • 原文地址:https://www.cnblogs.com/feng9exe/p/6733656.html
Copyright © 2011-2022 走看看