CABasicAnimation not animating my property

后端 未结 3 929
春和景丽
春和景丽 2021-02-09 02:39

I\'ve been trying to understand what is wrong with my animation and I still haven\'t figure it out. I think it should be really straight forward, but there is probably something

3条回答
  •  感情败类
    2021-02-09 02:48

    The key path should only be the key path of the property, not the name of the object as well.

    Use this

    [CABasicAnimation animationWithKeyPath:@"frame"]
    

    instead of this

    [CABasicAnimation animationWithKeyPath:@"layerImage.frame"]
    

    And just BTW, when you add animation to a layer, the key doen't mean the key property to animate. Just the key (name) that you want this animation to have (this refers to the last line your code)

提交回复
热议问题