zoukankan      html  css  js  c++  java
  • iOS-模态视图动画

    ios视图切换的动画效果

     

    方法1.把下面的这段代码加到viewController或者view出现的时候就OK

     self.view.transform=CGAffineTransformMakeScale(0.01f, 0.01f);//先让要显示的view最小,0.01f是指比例
        
        [UIView beginAnimations:nil context:UIGraphicsGetCurrentContext()];
        [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
        [UIView setAnimationDuration:0.5f];//动画时间,自己看着办
        self.view.transform = CGAffineTransformMakeScale(1.0f, 1.0f);//将要显示的view按照正常比例显示出来
        //[UIView commitModalAnimations];
        [UIView commitAnimations];

     

     

    方法2.当push一个viewController的时候的添加效果

    把下面的代码加到push的方法里面就OK

        CATransition *myTranstiton = [CATransition animation];
        myTranstiton.duration = 0.5;
        myTranstiton.type = kCATransitionFade;    
        //myTranstiton.subtype = kCATransitionFromTop;    
        [self.view.superview.layer  addAnimation:myTranstiton forKey:nil ];    
        MainViewController * _mainViewController=[[MainViewController alloc] init]; 
        [self presentModalViewController:_mainViewController animated:NO];

     

  • 相关阅读:
    GL线程
    Texture,TextureRegion,Sprite,SpriteBatch
    设置壁纸
    CentOS7下安装MySQL,修改端口
    读《大道至简》有感
    课程作业01汇总整理
    读《大道至简》有感(伪代码)
    01实验性问题总结归纳
    oracle日期时间的加减法
    C# 根据年、月、周、星期获得日期等
  • 原文地址:https://www.cnblogs.com/linxiu-0925/p/5086019.html
Copyright © 2011-2022 走看看