views:

189

answers:

1

Hi, 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

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!

+2  A: 

Override the initWithLayer: method.

Peter Hosey
Thanks for the answer, it worked! In addition, overriding needsDisplayForKey made it updated every frame.
Kay