I have a UIScrollView where a lot of objects appear (UIImageView’s) during scrolling. However, when the user is scrolling, I want to fire messages to all these objects, in order to tell them that they shall not do anything stupid. When the UIScrollView decelerates, some animations happen at the visible objects. When the user moves on fast (pagingEnabled=YES), more and more objects are still animating, which will result in horrible scroll performance.
I want to tell them all to immediately stop and do nothing as soon as the user is scrolling. So, what can I do? A for-loop is bad for performance upon scrolling. It will jerk for a small moment, but that’s enough to make the user very very mad.
Also remember that the computers can only do things in a linear fashion. So no matter what you do you will have to use some sort of loop control structure.
perhaps kick off a thread that contains the loop. and the loop will call the
selector for each object. (remember for UI stuff it has to be executed on the main thread.)
and i asume you are using
To stop the animation.
if this is still not fast enough you will have to look at Core Animations, these will have extra efficiencies that will allow this to happen.