UIView Animation Blocks vs CAAnimation
iOS animation experts! What are the pros and cons of each method? I know Apple recommends blocks instead of the old UIView
animation methods (UIView
beginAnimations
, etc), but what about CAAnimation
? When would you use one method vs the other? Is there a tradeoff in terms of perfor开发者_开发知识库mance?
1) There is not much difference in terms of memory expenses between UIView's animation blocks and CALayers's
CAAnimation
nor in terms of the objects themselves.
2) There are limitations to the type of animations you can achieve with UIView's
animation, so you might be forced to use CAAnimation
anyway.
3) For those types of simpler animations that UIView can handle, it is usually a simpler API to use than that of CAAnimation
.
As miamk said, there are limitations to the types of animations you can achieve using the [UIView animateWith] method series. Personally I use CAAnimation, but that is because I am accustom to setting up animations that way. I feel you have more control. I tend to spend a day making a CAAnimation really really fine-tuned and then add it to my UIView extensions class so any view can use it.
精彩评论