zoukankan      html  css  js  c++  java
  • IOS视图缩放显示动画效果

    效果:视图从大--小缩放显示/小--大 (只是比例问题)


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

      self.view.transform = CGAffineTransformMakeScale(1.0f, 1.0f);//将要显示的view按照正常比例显示出来
      [UIView beginAnimations:nil context:UIGraphicsGetCurrentContext()];
      [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];  //InOut 表示进入和出去时都启动动画
      [UIView setAnimationDuration:0.5f];//动画时间
      self.view.transform=CGAffineTransformMakeScale(0.01f, 0.01f);//先让要显示的view最小直至消失
      [UIView commitAnimations]; //启动动画
      //相反如果想要从小到大的显示效果,则将比例调换
      //UIGraphicsGetCurrentContext  里面东西很丰富。


    ——————————————————————————————————————————


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

  • 相关阅读:
    第十三周总结
    第一阶段意见评论
    第十二周总结
    关于transform的3D变形函数
    12.9学习内容
    12.8学习的内容
    这是自己的第一篇博客
    食物链
    poj1988Cute Stacking
    银河英雄传说
  • 原文地址:https://www.cnblogs.com/ranger-jlu/p/3895090.html
Copyright © 2011-2022 走看看