How exactly to subclass CALayer and use a custom property?

后端 未结 1 394
既然无缘
既然无缘 2021-01-31 05:31

I am trying to create a subclass of CALayer with a custom index property that I can both animate and change directly in order to display a different pi

1条回答
  •  广开言路
    2021-01-31 06:32

    There is an excellent tutorial on the web that explains how to create a custom CALayer subclass with animatable properties. I haven't had occasion to try it yet, but I bookmarked it. Here is the link:

    Animating Pie Slices Using a Custom CALayer

    It looks like the main tricks are:

    Use @dynamic, not @synthesize for the animatable properties of your custom CALayer.

    Override actionForKey:, initWithLayer:, and needsDisplayForKey:, and perhaps drawInContext:

    0 讨论(0)
提交回复
热议问题