ios - Why do docs indicate CALayer animations must be in UIView animation blocks? -


I am currently reading Apple, where I got the following transit about the layer-backed views in iOS:

If you want to use the core animation classes to start the animation, you should issue all your core animation calls from within the visual-based animation block. The UIView class disables layer animation by default but re-enables them within the animation blocks. Therefore, any changes made outside the animation block are not animated.

Just below the quote, the documentation includes the following code entry:

  [UIView animated Wiktionary: 1.0 animation: ^ {// opacity completely Change myView.layer.opacity = 0.0; // Change the position explicitly CABasicAnimation * theAnim = [with CABasic animation animation: @ "status"]; TheAnim.fromValue = [NSValue Value withCGPoint: myView.layer.position]; TheAnim.toValue = [NSVLite valueWithCGPoint: myNewPosition]; TheAnim.duration = 3.0; [MyView.layer addAnimation: theAnim forKey: @ "Animframe"]; }];  

Which means that both underlying and explicit animations should be kept in the animation block on CALayer s backing UIView s.

However, I have found that it is clearly unreal. Specifically, I have successfully implemented clear animation using the core animation classes outside of a UIView animation block

Am I misunderstood this route, or is it outdated Is it, or something else?


Some additional notes:

I think "UIView class disables layer animation by default, but in the animation block Re-enables "refers to" + [UIView setAnimationsEnabled:] method. When I come back to a computer that can do this, I see whether the + [UIView areEnimationsEnabled] returns YES or NO Is it or not?

This quote refers to the layer that supports the view. It is not right for stand-alone layers, which you create and manage yourself.


Each view on iOS is backed by a layer when you change the properties of the scene, it changes the property of the underlying layer, by default the layer contains unlimited animation, but when you have a If the UIView animation is inside the block, then "disables" that layer, this is the part of the document that is referring to the document.

There are a few ways to use the core animation to animate the property of a layer is the most common when you want to animate the property, then add the animation object to the layer, but you You can also optimize through the dictionary and the styles dictionary if you always want to animate the change while the last two will also be disabled for the layer which supports a view Are there.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -