Let's say that I make an animation like so:
[UIView animateWithDuration:0.5
delay:0.0
options:UIViewAnimationOptionCurveEaseInOut
animations:^{
someView.frame = CGRect(0, 100, 200, 200);
}
completion:nil];
And Let's say that I have subviews inside someView that have their layoutSubviews method overridden. I would like to identify an ongoing animation inside that layoutSubviews and make corresponding actions depending if the animation I detected was created by me, or if it is for example an animation caused by device rotation.
To get the animations in progress I use the following code:
for (NSString *animationKey in [self.layer animationKeys])
{
CAAnimation *animation = [self.layer animationForKey:animationKey];
// ... Do something ...
}
Now If I would be using CABasicAnimation I could set arbitrary properties using:
[myAnimation setValue:@"mySuperCoolAnimation" forKey:@"AnimationName"];
And then check that key on the other side. But I would like to avoid using CABasicAnimation because of my complex view hierarchy.
So for simplicity sake is there a way to do something like that using UIView animateWithDuration: