Is it possible to have more than one animation delegate at the same time?
I am concerned that this is not possible because setAnimationDelegate: from UIView is a class method. But maybe I'm wrong?
Background: The problem is that I have many objects of the same class, and I want to implement a method that does some nice animations specifically for that object. These animations are a bit complex and have several steps. So I need to be notified when the animation has stopped. Now it can happen that 10 objects from this class start animating at the same time.
a source to share
The method +[UIView beginAnimations:context:]
allows you to pass a specific context
one that is passed along with the finalizer. You can use this context to blur between different instances when you call the finalizer.
Since the context is typed like (void *)
, it can be pretty much anything you want, like a pointer to an object instance, a unique identifier, or a custom structure.
If your objects implement a common protocol, you can pass them as context and in a method animationDidStop
, just call the method defined by the protocol. Therefore, even though you have one method of a class animationDidStop
class, it can act as a dispatcher for the fork methods.
a source to share