English 中文(简体)
Are multiple UIView animation callbacks a bad idea (i.e. cause mem issues)?
原标题:

I have multiple UIView animations running in my app. They are very short, and then make callbacks to a method that then usually fires off another animation. This leads to a lot of little animations running at the same time, each firing back callbacks.

This actually performs pretty well, and for the first few levels (the app is a game), no problems are observed. However, as you continue to play deeper into the game, I m starting to get memory warnings and ultimately crashes. I ve put NSLog in all of my dealloc methods, so I can see that everything is being properly released and dealloc d. I ve also run static analysis on the app and fixed anything it found.

The weird part to me is this: Shouldn t any performance problems caused by running multiple animations be processor bound (i.e. shouldn t I see a bunch of slowdown and such)? It seems that everything performs just fine, it just runs up memory too fast and there s nothing more I can free. Is there something in the framework on the UIView side of things that will need lots of memory to do these operations? Is there perhaps a leak in the framework I need to avoid when doing these?

Additional note: I m animating a custom class that extends UIView and has a label and a UIImageView inside of them.

最佳回答

Multiple animation shouldn t cause memory warnings..

I suggest you should run Instruments for Leaks, ObjectAlloc & CPU Samplers.. That would give a much better view than NSLogs in dealloc

问题回答

You don t show any code so it s hard to give specific advice, however, have you considered using Core Animation layers instead of UIViews? If you need to animate text, you ll have to use a view since there is no CATextLayer on the phone, however, Core Animation provides the facilities to draw complex sprites in a 2d space making it a great candidate for many games.

Best Regards.





相关问题
What to look for in performance analyzer in VS 2008

What to look for in performance analyzer in VS 2008 I am using VS Team system and got the performance wizard and reports going. What benchmarks/process do I use? There is a lot of stuff in the ...

SQL Table Size And Query Performance

We have a number of items coming in from a web service; each item containing an unknown number of properties. We are storing them in a database with the following Schema. Items - ItemID - ...

How to speed up Visual Studio 2008? Add more resources?

I m using Visual Studio 2008 (with the latest service pack) I also have ReSharper 4.5 installed. ReSharper Code analysis/ scan is turned off. OS: Windows 7 Enterprise Edition It takes me a long time ...

Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

热门标签