简体   繁体   English

您可以使用动画块缓存视图吗

[英]can you cache a view using animation blocks

Is there an equivalent way of doing this using animation blocks 是否有使用动画块执行此操作的等效方法

[UIView setAnimationTransition:<some_transition> forView:<view> cache:YES];

this seemed to be handy way of not getting staggered animations or to make animations smooth so it doesn't keep redrawing every so often. 这似乎是不产生交错动画或使动画平滑的便捷方法,因此它不会经常重绘。 But i can't seem to figure out how to do this with animation blocks. 但是我似乎无法弄清楚如何用动画块来做到这一点。 Maybe i've just missed something somewhere. 也许我只是想念某个地方。

Look at the block based methods for transitions: +[UIView transitionFromView:toView:duration:options:completion:] and +[UIView transitionWithView:duration:options:animations:completion:] . 查看基于块的过渡方法: +[UIView transitionFromView:toView:duration:options:completion:]+[UIView transitionWithView:duration:options:animations:completion:]

The views are by default cached when you use these block based methods. 使用这些基于块的方法时,默认情况下将缓存视图。 You turn caching of using the UIViewAnimationOptionAllowAnimatedContent option. 您可以使用UIViewAnimationOptionAllowAnimatedContent选项进行缓存。

The option only makes sense for transitions. 该选项仅对过渡有意义。 Most animations that you'd use an animation block for couldn't make use of a rasterized cache of just one entire view, because they involve multiple views that move relative to one another and must be composited in every frame of the animation. 您要使用动画块的大多数动画无法利用仅一个完整视图的栅格化缓存,因为它们涉及相对于彼此移动的多个视图,并且必须在动画的每一帧中进行合成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM