Search code examples
iphoneiosmultithreadingcore-animation

Is a CAAnimation delegate guaranteed to be notified on the main thread?


Core animations run on their own threads. But is animationDidStop:finished: guaranteed to run on the main thread when the animation finishes? It does in my testing, but I don't know whether I can depend on that at all times and across all versions of iOS.


Solution

  • It does occurs on the main thread as mentioned also in this thread. Starting iOS 4.0 and later consider using the block-based animation methods though.

    EDIT

    From the official doc for the description of the animateWithDuration:animations:completion: it is mentioned that the completion block is performed at the beginning of the next run loop cycle. I believe we are talking about the loop cycle associated to the main thread here if you are invoking your method on the main thread.