I have 开发者_JAVA百科a game with a number of animated "monsters". The animation is made with ~20 png images for each monster. So I use UIImageView
with setted animationImages:
.
The problem is that sometimes there can be a lot of monsters on the screen (up to 110 in total and up to 10 different). So when all of them are on the screen at the same time - I see animation problems (very low fps).
Please, can you give me some advice - how can I solve this problem?
You can use CoreAnimation
as described in this tutorial. It explains pretty well all the techniques you can use to increase the performance from where you are now (first of all it doesn't use UIViews
and the standard animationImages
, second it makes use of sprites (also called texture atlases) which will not only increase performance but also will make your life a lot more easier when it comes to managing the image resources).
Also you can use CADisplayLink to create a game loop
in which you can make all the updates. There are several questions/answers here on SO that describe just that.
精彩评论