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

  • 相关阅读:
    JNI接口的使用(简单版)
    Android内核剖析(1)
    Spring 和 Mybatis 整合
    AppStore被拒原因及总结
    iOS开发中,应用内直接跳转到Appstore
    ios 中生成二维码和相册中识别二维码
    IOS开发中(null)与<null>的处理
    融云即时通讯~~
    iOS中菊花。。。
    关于判断邮箱 手机号等一系列的正则表达式
  • 原文地址:https://www.cnblogs.com/ranger-jlu/p/3895090.html
Copyright © 2011-2022 走看看