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

     

  • 相关阅读:
    学习subprocess模块...
    【排列组合】
    【约瑟夫问题】
    【craps赌博游戏】
    【洗扑克牌(乱数排列)】
    【最大访客数】
    【后序式的运算】
    【中序式转后序式】
    【python基础】之元组 集合 字典
    【费式数列(Fibonacci数列)】
  • 原文地址:https://www.cnblogs.com/linxiu-0925/p/5086019.html
Copyright © 2011-2022 走看看