views:

300

answers:

2

I have an scroll view with some sophisticated animations happening during scrolling. Although after 2 weeks of finetuning the performance is acceptable now, the scrolling is not 100% smooth when the animations happen.

I know that core animation does animations in a background thread. But I wonder if it would help to split those animation blocks (10 of them at pretty much the same time) into threads.

There are a few methods that look interesting:

– performSelector:onThread:withObject:waitUntilDone: – performSelectorInBackground:withObject:

or is that nonsense to do?

+2  A: 

No, it won't help. As you correctly stated yourself, Core Animation already runs in a seperate thread. Core Animation is smart enough to handle animation blocks as efficiently as possible. I wouldn't advise interfering with it.

The Core Animation Programming Guide says:

An abstract animation interface that allows animations to run on a separate thread, independent of your application's run loop. Once an animation is configured and starts, Core Animation assumes full responsibility for running it at frame rate.

Kriem
Well, that's true. But since I make a lot of blocks, I wonder if they're going to run all in the same thread?
Thanks
Yes they will. Question is, will it look pretty. :)
Kriem
Of course, as always, you'll only know if you try. I guess this question has to do with the one where I advise using OpenGL?
Kriem
Yep, that's right. You're totally right with OpenGL. But for this project I want to stick to CA. Just for learning :)
Thanks
A: 

Are you sure the choppy behavior is really from CA? Do you have anything else going on?

If you have any background network access, consider moving that into a separate thread - the time taken to service those calls takes away from time the UI spends updating the screen as you scroll.

Kendall Helmstetter Gelner
no, there's nothing going on. Indeed I had some preloading code, but that caused a worse performance than without any preloading. I ended up loading all views in the scrollview at once at the beginning, since they're not many anyways.
Thanks