catransition
Catransition is a subclass of caanimation, which enables simple transition animations by setting the type and subtype.
Type:
/* Common transition types. */ca_extern NSString * Const Kcatransitionfade __osx_available_starting (__mac_10_5, __iphone_2_0); CA_EXTERN NSString * Const Kcatransitionmovein __osx_available_starting (__mac_10_5, __iphone_2_0); Ca_extern NSString * Const Kcatransitionpush __osx_available_starting (__mac_10_5, __iphone_2_0); Ca_extern NSString * const Kcatransitionreveal __osx_available_starting (__mac_10_5, __iphone_2_0);
can also be used directly @ "Fade", @ "Movein", @ "push", @ "reveal" instead, in addition to these four kinds also: @ "Pagecurl", @ "cube", @ "Flip" and so on.
Subtype Type:
/* Common transition subtypes. */ca_extern NSString * Const kcatransitionfromright __osx_available_starting (__mac_10_5, __IPHONE_2_0); CA_ EXTERN NSString * Const kcatransitionfromleft __osx_available_starting (__mac_10_5, __iphone_2_0); CA_EXTERN NSString * Const kcatransitionfromtop __osx_available_starting (__mac_10_5, __iphone_2_0); Ca_extern NSString * Const Kcatransitionfrombottom __osx_available_starting (__mac_10_5, __iphone_2_0);
You can also use the corresponding string directly: @ "Fromright", @ "Fromleft", @ "Fromtop", @ "Frombottom"
present type transition AnimationsSet animated to No and add animations to Self.view.window.layer
/*** catransition ***///catransition-(catransition *) transition{ catransition *transition = [CATransition Animation]; transition.duration = 1; Transition.type = @ "Cube"; Transition.subtype = @ "Fromright"; Transition.timingfunction = [Camediatimingfunction Functionwithname:kcamediatimingfunctioneasein]; return transition;} -(void) OnClick: (ID) sender{ ViewController2 *vc2 = [[ViewController2 alloc] init]; [Self PRESENTVIEWCONTROLLER:VC2 animated:no completion:nil]; [Self.view.window.layer addanimation:[self transition] forkey:@ "ktransitionanimation"];}
Push type transition animationsSet animated to No and add animations to Self.view.window.layer or Self.navigationController.view.layer
/*** catransition ***///catransition-(catransition *) transition{ catransition *transition = [CATransition Animation]; transition.duration = 1; Transition.type = @ "Cube"; Transition.subtype = @ "Fromright"; Transition.timingfunction = [Camediatimingfunction Functionwithname:kcamediatimingfunctioneasein]; return transition;} -(void) OnClick: (ID) sender{ ViewController2 *vc2 = [[ViewController2 alloc] init]; [Self.navigationcontroller pushviewcontroller:vc2 Animated:no]; [Self.view.window.layer addanimation:[self transition] forkey:@ "ktransitionanimation"]; or [Self.navigationController.view.layer addanimation:[self transition] forkey:ktransitionanimation];}
Catransition Custom Uiviewcontroller Transition animations