zoukankan      html  css  js  c++  java
  • #在蓝懿学习iOS的日子#第七个练习日

    复习这两天学习的内容

    动画
       //    frame  bounds  alpha  背景颜色  center  transform(转换)
        UIImageView* iv =[[UIImageView alloc]initWithFrame:CGRectMake(100, 100, 100, 100)];
        iv.image = [UIImage imageNamed:@"8.jpg"];
        [self.view addSubview:iv];
        //NO.1旋转渐变animateWithDuration(动画持续时间)
    //    [UIView animateWithDuration:3 animations:^{
    //        iv.center = CGPointMake(300, 300);
    //        iv.alpha = .5;
    //        iv.transform = CGAffineTransformScale(iv.transform, .5, .5);
    //        //旋转
    //        iv.transform =CGAffineTransformRotate(iv.transform, 90.0*M_PI/180);
    //    }];
         //NO.2原地向左旋转  completion完成
    //    [UIView animateWithDuration:3 animations:^{
    //        iv.transform = CGAffineTransformRotate(iv.transform, 90.0*M_PI/180);
    //    } completion:^(BOOL finished) {
    //        [iv removeFromSuperview];
    //    }];
        //NO.3 delay(延迟时间)
        [UIView animateWithDuration:3 delay:3 options:UIViewAnimationOptionCurveEaseIn animations:^{
            iv.center = CGPointMake(300, 300);
        } completion:^(BOOL finished) {
            [iv removeFromSuperview];
        }];
    }
      
        //旋转,左旋

        number++;

        CGAffineTransform rotate = CGAffineTransformMakeRotation(number / 180.0 * M_PI );

        [viewDemo setTransform:rotate];

    }

    如果使用此方法连续点击button就可以显示处一点一点的移动效果

    每次旋转90度的话可以使用一下的代码实现效果

    -(void)testViewDemo

    {

    //旋转,右旋

        number = number+90.0;

        CGAffineTransform rotate = CGAffineTransformMakeRotation(number / 180.0 * M_PI );

        [viewDemo setTransform:rotate];



    UIView实现左旋效果

    //旋转,左旋

        number = number-90.0;

        CGAffineTransform rotate = CGAffineTransformMakeRotation(number / 180.0 * M_PI );

        [viewDemo setTransform:rotate];
       
          
  • 相关阅读:
    【NOIP2000】【vijos1347】乘积最大
    【JSOI2014】【BZOJ5039】序列维护(线段树模板)
    【NOIP2013】【Luogu1966】火柴排队(逆序对)
    【基础】排序算法学习笔记
    【Luogu1908】逆序对(树状数组求逆序对)
    【POJ2299】Ultra-QuickSort(逆序对,归并排序)
    【POJ1723】SOLDIERS(中位数,货仓选址)
    【HAOI2008】【BZOJ1045】糖果传递(环形纸牌均分)
    【codevs1004】四子连棋
    Jzoj4900 平方数
  • 原文地址:https://www.cnblogs.com/odileye/p/4971228.html
Copyright © 2011-2022 走看看