Catransition Custom Uiviewcontroller Transition animations

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.