How do you explicitly animate a CALayer's backgroundColor?

前端 未结 2 557
离开以前
离开以前 2020-12-02 07:30

I\'m trying to construct a CABasicAnimation to animate the backgroundColor property of a Core Animation CALayer, but I can\'t figure out how to properly wrap a CGColorRef va

2条回答
  •  离开以前
    2020-12-02 08:03

    I was struggling with this problem until I experimentally found the roadblock. Setting the backgroundColor property of the layer, either directly or via the animation, will have no effect if you change the background color from the default (of unspecified) in Interface Builder, in the context of course of an item (such as UILabel) that's been placed in IB. So leave the background color unspecified and the above should work.

提交回复
热议问题