What I have:
I have UIView's and CAGradientLayer hierarchies that I use to set the "background color" of this hierarchy. So I have something like this:
ViewA β ViewB β CAGradientLayer
What am I doing:
At some point, I want to animate the frame (only its height) in ViewA. So it would be something like this:
[UIView animateWithDuration:timeInterval delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^{ viewA.frame = newFrame; }]
Problem:
The problem is that the CAGradientLayer will not animate its frame, it will just change its frame, and then viewA will start the animation as intended (this is clearly seen if you set the simulator to slow motion animation).
What I tried:
I tried to do what Apple recommends here by executing it inside the UIView animation UIView , but it actually doesn't work, because I'm still animating the frame here:
viewA.frame = newFrame;
I also understand that I have to animate the borders, not the CALayer frame, the problem is that how can I animate the borders and when does the ViewA frame animation leave the CALayer from the animation?
What I want:
I just want to animate the change in its height, so I would simultaneously see the viewA and CAGradientLayer .
Peres source share