How do you implement kCATransitionPush using CAAnimation subclasses in iOS?
CAAnimation *animation;
// How do you create an animation that does the same than:
// CATransition *animation = [CATransition animation];
// [animation setType:kCATransitionPush];
[self.view.layer addAnimation:animation forKey:nil];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1];
[self.view addSubview:change];
[UIView commitAnimations];
I’m aware that UIView animations can also be used, but it would help me to understand Core Animation better if I could implement a kCATransitionPush transition from the ground-up.
In order to execute the animations simultaneously over the two layers, you must add the adequate CAAnimationGroup to each layer.
nextViewAnimation would be:
and currentViewAnimation:
These methods create the basic animations:
With the boolean forward you can simulate the transition “from left” or “from right”.