• iOS图片立体旋转


    图片做动画效果

    //动画开始

    -(void)startAnimationMsg

    {

        num = 0;

        self.timer = [NSTimer timerWithTimeInterval:0.4 target:self selector:@selector(updateAnimationMsg) userInfo:nil repeats:YES];

        [[NSRunLoop mainRunLoop] addTimer:self.timer forMode:NSDefaultRunLoopMode];

        /*

        CABasicAnimation* rotationAnimation;

        rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.y"];

        rotationAnimation.toValue = [NSNumber numberWithFloat: -M_PI * 2.0 ];

        rotationAnimation.duration = 2;

        rotationAnimation.cumulative = YES;

        rotationAnimation.repeatCount = 0;

        [self.OpenImageView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];

        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{

            [self startAnimation];

        });

         */

    }

    -(void)updateAnimationMsg

    {

        switch (num) {

            case 0:

                self.OpenImageView.image = [UIImage imageNamed:@"img_open-02.png"];

                num ++;

                break;

            case 1:

                self.OpenImageView.image = [UIImage imageNamed:@"img_open-03.png"];

                num++;

                break;

            case 2:

                self.OpenImageView.image = [UIImage imageNamed:@"img_open-01.png"];

                num = 0;

                break;

            default:

                break;

        }

    }

    //动画结束

    -(void)endAnimationMsg

    {

         self.OpenImageView.image = [UIImage imageNamed:@"img_open-01.png"];

        [self.timer invalidate];

    }

     

  • 相关阅读:
    webAPI 控制器(Controller)太多怎么办?
    mysql Unknown error 1054
    .NET MVC项目设置包含Areas中的页面为默认启动页
    EF C# ToPagedList方法 The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must ……
    控制台Main函数传参
    C#编码规范
    Linq扩展方法
    Linq操作ArrayList
    LINQ和文件目录
    LINQ To Objects
  • 原文地址:https://www.cnblogs.com/huzi213/p/7238224.html
Copyright © 2020-2023  润新知