CATransition 动画处理视图切换

一:引入包和头文件;

        需要在frameworks中添加QuartzCore.framework 

    在接口程序中加上头文件   #import <QuartzCore/QuartzCore.h>

二:使用

    CATransition *myAnimation = [CATransition animation];
    myAnimation.duration = 0.8f;
    myAnimation.type = kCATransitionPush;
    myAnimation.subtype = kCATransitionFromBottom;
    [self.navigationController.view.layer addAnimation:myAnimation forKey:nil];
    [self.navigationController popViewControllerAnimated:NO];

 三:动画类型:

       type:

Common Transition Types

These constants specify the transition types that can be used with the type property.

NSString * const kCATransitionFade;

NSString * const kCATransitionMoveIn;

NSString * const kCATransitionPush;

NSString * const kCATransitionReveal;

   subType:

Common Transition Subtypes

These constants specify the direction of motion-based transitions. They are used with the subtype property.

NSString * const kCATransitionFromRight;

NSString * const kCATransitionFromLeft;

NSString * const kCATransitionFromTop;

NSString * const kCATransitionFromBottom;

posted @ 2013-06-20 10:35  cocoajin  阅读(470)  评论(0编辑  收藏  举报