During development, view switching is often encountered. Sometimes we do not switch based on the navigation controller. However, in actual development, sometimes we need to implement the push effect, the following code example shows how to implement the default animation effects of push and POP:
1. push default animation effect
Catransition * transition = [catransition animation];
Transition. Duration = 0.3f;
Transition. timingfunction = [camediatimingfunction functionwithname: kcamediatimingfunctioneaseineaseout];
Transition. type = kcatransitionpush;
Transition. Subtype = kcatransitionfromright;
Transition. Delegate = self;
[Self. contentview. layer addanimation: Transition forkey: Nil];
[Self. contentview addsubview: Self. productdetailcontroller. View];
Note: Self. contentview is the uiview in the project, and self. productdetailcontroller is the controller in the project.
You only need to replace the two with the appropriate content.
Ii. Default pop animation effect
Catransition * transition = [catransition animation];
Transition. Duration = 0.3f;
Transition. timingfunction = [camediatimingfunction functionwithname: kcamediatimingfunctioneaseineaseout];
Transition. type = kcatransitionpush;
Transition. Subtype = kcatransitionfromleft;
Transition. Delegate = self;
[Self. View. superview. layer addanimation: Transition forkey: Nil];
[Self. View removefromsuperview];
Note: The main page switching display mode is set for. type.
. Subtype sets the page rotation between left and right