CATransition(os开发之画面切换) 的简单用法

CATransition 的简单用法

 //引进CATransition 时要添加包“QuartzCore.framework”,然后引进“#import

    CATransition  *animation = [CATransition animation];

    animation.duration = 0.6 ;

    

    //动画的切换时间速度

    animation.timingFunction = [CAMediaTimingFunction functionWithName:@"easeInEaseOut"];

    

    //动画切换的方式

    /*1.kCATransitionMoveIn 新的视图把旧的视图掩盖

     *2.kCATransitionPush 旧的视图移走,新的视图移进来

     *3.kCATransitionFade 逐渐消失,相当于调整透明度,除了这没有方向,其他的都有

     *4.kCATransitionReveal 旧的视图移走,显示出新的视图

     */

//    animation.type = kCATransitionReveal;

//这类是API引入的,在苹果官网是不会承认的,所以不建议使用

    /*1.animation.type = @"cube"; //立方体效果

     *2.animation.type = @"suckEffect";//犹如一块布被抽走

     *3. animation.type = @"oglFlip"; //上下翻转效果

     *4. animation.type = @"rippleEffect"; //滴水效果

     *5. animation.type = @"pageCurl"; //向左翻页

     *6.animation.type = @"pageUnCurl"; //向下翻页

     */

     animation.type = @"pageUnCurl";

    animation.subtype =kCATransitionFromRight ;

    

    //视图上加载动画

    [self.myView.layer addAnimation:animation forKey:@"animationForKey"];

    [self.myView exchangeSubviewAtIndex:0 withSubviewAtIndex:1];

    

    //用来设置设置UINavigation

    

//    CATransition *transitionAnimation = [CATransition animation];

//    transitionAnimation.duration = 0.5;

//    transitionAnimation.timingFunction = [CAMediaTimingFunction functionWithName:@"easeInEaseOut"];

//    transitionAnimation.type  = kCATransitionMoveIn;

//   

//    transitionAnimation.subtype = kCATransitionFromTop;

//    [self.navigationController.view.layer addAnimation:transitionAnimation forKey:@"test" ];

//    

//    UIViewController *viewVC = [[UIViewController alloc] init];

//    [self.navigationController pushViewController:viewVC animated:NO];

转载于:https://www.cnblogs.com/meixian/p/5371138.html

你可能感兴趣的:(CATransition(os开发之画面切换) 的简单用法)