究竟removeOnCompletion = NO究竟做了什么? [英] What exactly does removedOnCompletion = NO do?

查看:229
本文介绍了究竟removeOnCompletion = NO究竟做了什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CAAnimation提供removedOnCompletion属性,默认为YES。

CAAnimation provides the removedOnCompletion property which defaults to YES.

让我们认识到这些事实:

Let's recognize these facts:

A)核心动画仅影响表示树,但不影响模型树。完成动画后,您最终会看到模型树中设置的内容。例如,您可以将fillMode设置为kCAFillModeBoth,一旦动画完成,它将把表示树中的值交换到模型树。这会导致您的动画无法恢复(这很可能是您想要的)。

A) Core Animation only affects the Presentation Tree, but not the Model Tree. When an animation is done, you end up seeing whatever is set in the Model Tree. You can set a fillMode to kCAFillModeBoth for example, which will swap the value from the Presentation Tree over to the Model Tree once the animation is done. This causes your animation to not revert back (which is most likely what you want).

B)我做了一个实验。 removedOnCompletion = NO NOT 与kCAFillModeBoth或kCAFillModeForwards具有相同的效果。更确切地说:完成动画时结果的效果绝对没有影响。它是否被删除,它似乎根本不会影响表示树。

B) I did an experiment. removedOnCompletion = NO will NOT have the same effect as kCAFillModeBoth or kCAFillModeForwards. To be more precise: It has absolutely no effect on how the result looks like when the animation is done. Wether it is "removed" or not, it seems to not affect the Presentation Tree at all.

要解释removeOnCompletion真正做了什么,文档在这方面太弱了。我不明白。任何人都可以解释究竟会删除什么,以及没有删除它的好处是什么?

To explain what removedOnCompletion really does, the documentation is too weak in this regard. I don't get it. Can anyone explain what exactly would be removed, and what's the benefit of not having it removed?

我的猜测是Apple正在谈论动画师对象本身,这是添加的使用-addAnimation:forKey:...再次:保持它的意义是什么?

My guess is that Apple is talking about the animator object itself, which is added to the layer with -addAnimation:forKey: ... but again: What's the point of keeping it around?

推荐答案

removedOnCompletion

基本上,当动画完成后,动画会从图层的动作中移除。

Basically, is the animation removed from the layer's actions when that animation is done.

YES - 如果您只想使用动画一次,则无需使用委托方法从图层中删除动画完成后。

YES - If you intend to use the animation only once, you do not need to use the delegate method to remove the animation from the layer upon completion.

fillMode

此属性控制动画完成时视觉上发生的事情,具体取决于指定的填充模式类型。

This property controls what happens visually when the animation is completed, depending on the type of fill mode specified.

这篇关于究竟removeOnCompletion = NO究竟做了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆