Trying to wrap my brain around animations here. Here is my basic situation:
_________
|Parent |
| |
| |
| _____ | _____
| |A | | |B |
| |_____| | |_____|
|_________|
where Parent is the parent view and A and B are both UIView instances. I chose to make A and B UIViews because, as I understand it, layers cannot receive user interaction. The animation I want to do is very simple: I simply want A to slide offscreen to the left while B slides in from the right.
I tried something like the following:
CALayer *layer = viewA.layer;
layer.position = CGPointMake(initialLayer.position.x, initialLayer.position.y - 480);
but the property updated immediately with no animation.
I was able to get this working using CABasicAnimation without too much trouble, but I want to learn to use implicit animations for this kind of scenario so I can prototype more quickly in the future. This post seems to suggest that UIViews can't perform implicit animation (at least by default).
My question:
- Is there a way to implicitly animate properties on a
UIView's layer? How? - If not, is there a better/canonical way to do this that's different from my method?