【问题标题】:How is the presentation layer of a CALayer generated?CALayer的表现层是如何生成的?
【发布时间】:2010-05-09 08:50:11
【问题描述】:

我在使用 Core Anmiation 为我的自定义图层属性设置动画时遇到了困难。
我的问题是如何生成 CALayer 的演示文稿。 这是我现在拥有的:

    @interface MyLayer : CALayer {
      NSMutableDictionary* customProperties;
    }

    @property (nonatomic, copy) NSMutableDictionary* customProperties;

    @end

当我尝试使用 CABasicAnimation 和 addAnimation:forKey: 为键路径“customProperties.roll”设置动画时,似乎 customProperties 变量没有从模型层复制到表示层,并且 customProperties 的表示层似乎为零,未能更新键“roll”的值。
有没有办法正确地为字典中的值设置动画?在制作动画时,模型层和表示层之间的确切关系是什么?
谢谢!

【问题讨论】:

    标签: cocoa core-animation


    【解决方案1】:

    【讨论】:

    • 感谢您的回答,它成功了!此外,重写 needsDisplayForKey 使其每帧更新。
    • nomadplanet.fr/2010/11/…给出更详细的答案
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-24
    • 1970-01-01
    相关资源
    最近更新 更多