如何提高CALayer动画的性能? [英] How to improve performance of CALayer animations?
问题描述
在学习Core Animation时,我将UIView类别划分为一个子视图,该子视图被分成许多图块并进行分散。
https://github.com/minorblend/HNTileDisappear
但是,当瓦片数不小动画的FPS急剧下降。
是否有任何方法或想法可以改善这种CALayer动画的性能?
while studying Core Animation, I've made a UIView category which makes a subview be broken into a lot of tiles and diffused. https://github.com/minorblend/HNTileDisappear However, when the number of tiles are not small FPS of animation drops steeply. Is there any way or idea to improve the performance of this kind of CALayer animation?
推荐答案
请注意:
1)在图层上将 shouldRasterize
设置为YES
1) set shouldRasterize
to YES on your layers
2)如果可以,不要在帧中使用分数
2) don't use fractional values in frames if you can
3)使图层不透明
4)还尝试在图层上设置 drawsAsynchronously
属性
4) try also setting the drawsAsynchronously
property on the layers
这篇关于如何提高CALayer动画的性能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!