The UIView#transitionFromView:toView:duration:options:completion:There are only limited animations, but I would like to have an animation that slides left and right like push transition.
ios objective-c
Use the CATransition
class in the Core Animation Framework (Quartz Core Framework).
Core Animation Programming Guide
Transition Animations Support Changes to Layer Visibility
This is what push-like animation looks like.
CATransaction begin;
CATransaction setValue: (id)kCFBooleanTrue
forKey —kCATransactionDisableActions ;
CATransition* transition= CATransition animation;
transition.delegate=self;
transition.duration=.4f;
transition.timingFunction= [CAMediaTimingFunctionFunctionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type =kCATtransitionPush;
transition.subtype=(isRight)?kCATtransitionFromLeft:kCATtransitionFromRight;
targetView.layer addAnimation:transition
forKey:nil];
CATransaction commit ;
© 2025 OneMinuteCode. All rights reserved.