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

     

  • 相关阅读:
    (四)资源文件分类
    (三)整合SSH测试项目
    (二)搭建SSH环境
    (一)新建一个javaweb项目
    Python学习——使用dict和set
    POJ 2104 K-th number
    bzoj 3669: [Noi2014] 魔法森林 LCT版
    bzoj 3626: [LNOI2014]LCA
    bzoj 2588 Count on a tree
    bzoj 3514: Codechef MARCH14 GERALD07加强版
  • 原文地址:https://www.cnblogs.com/linxiu-0925/p/5086019.html
Copyright © 2011-2022 走看看