如何生成CALayer的表示层? [英] How is the presentation layer of a CALayer generated?

查看:150
本文介绍了如何生成CALayer的表示层?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法使用核心动画来动画我的自定义图层属性。\\
我的问题是如何生成CALayer的演示文稿。
这里是我现在:

I'm having difficulties animating my custom layer property using Core Anmiation.
My question is how the presentation of a CALayer is generated. Here is what I have now:

    @interface MyLayer : CALayer {
      NSMutableDictionary* customProperties;
    }

    @property (nonatomic, copy) NSMutableDictionary* customProperties;

    @end

当我尝试对关键路径customProperties .roll使用CABasicAnimation和addAnimation:forKey:,似乎customProperties变量不会从模型层复制到表示层,并且表示层的customProperties显示为nil,无法更新键roll。
$
是否有办法正确设置字典中的值?动画时模型图层和表示层之间的确切关系是什么?

And when I try to animate the key path "customProperties.roll" using CABasicAnimation and addAnimation:forKey:, it seems that the customProperties variable doesn't get copied from the model layer to the presentation layer, and the customProperties of the presentation layer appears to be nil, failing to update the value for the key "roll".
Is there a way to animate values in a dictionary correctly? What is the exact relationship between a model layer and a presentation layer while being animated?
Thanks!

推荐答案

p>替换 initWithLayer:方法

Override the initWithLayer: method.

这篇关于如何生成CALayer的表示层?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆