zoukankan      html  css  js  c++  java
  • CATransition(os开发之画面切换) 的简单用法

    CATransition 的简单用法

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

        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];

  • 相关阅读:
    作业一:淘宝的创新点
    asp.net面试题130道
    windows7系统下怎么将“我的电脑”图标添加到任务栏
    用jquery控制html控件
    C# windows窗口项目
    无法从命令行或调试器启动服务,必须首先安装Windows服务(使用installutil.exe),然后用ServerExplorer、Windows服务器管理工具或NET START命令启动它
    c#用反射动态获取类型
    C# 提取逗号分割的字符串
    搜索框动态匹配——前端方式(只在页面加载时从后端获取一次数据)(推荐)
    汉字转拼音的代码——(js版)
  • 原文地址:https://www.cnblogs.com/meixian/p/5371138.html
Copyright © 2011-2022 走看看