How to prevent CALayer from implicit animations?

后端 未结 7 1572
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-25 14:59

When I set the backgroundColor property of an CALayer instance, the change seems to be slightly animated. But I don\'t want that in my case. How ca

相关标签:
7条回答
  • 2020-12-25 15:23

    If you want to disable implicit animations for a property completely, you can do so by assigning to the actions dictionary:

    myLayer.actions = @{@"backgroundColor": [NSNull null]};
    

    If you wish to disable the implicit animation on a case by case basis, then using [CATransaction setDisableActions:YES] is still the better way to do it.

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