I've got a UIView and I'm adding one of two subviews to it. Subview 1 is shown if event 1 comes in. Subview 2 is shown is event 2 comes in.
So, the following works (in pseudocode):
on_event1: add subview 1 and remove subview 2
on_event2: add subview 2 and remove subview 1
Now, I want to add a transition animation, crossfading between the two views by changing the alpha.
My problem is that if animation for event 1 is in progress and event 2 arrives, I cannot cancel the current animation and start the next. What I'd like to do is stop the current animation in its tracks and start the next one immediately.
How do I do this or the closest alternative to it?