• 动画demo


    #import "ViewController.h"

    @interface ViewController ()

    @end

    @implementation ViewController

    -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event

    {

      //  [UIView transitionWithView:self.aView duration:2 options:UIViewAnimationOptionTransitionFlipFromRight animations:nil completion:nil];

        

        

        self.aView.layer.borderColor=[[UIColor blackColor]CGColor];

      //  self.aView.layer.borderWidth=5;

       // self.aView.layer.cornerRadius=10;//设置圆角

        self.aView.layer.contents=(id)[UIImage imageNamed:@"l.jpg"].CGImage;

        self.aView.layer.shadowColor=[UIColor blackColor].CGColor;

        self.aView.layer.shadowOffset=CGSizeMake(10, 10);

        self.aView.layer.shadowOpacity=1;

        

    }

    -(void)test2

    {

        if ([_fromView subviews]) {

            [UIView transitionFromView:_fromView toView:_toView duration:2 options:UIViewAnimationOptionTransitionFlipFromLeft completion:nil];

        }else{

            [UIView transitionFromView:_toView toView:_fromView duration:2 options:UIViewAnimationOptionTransitionFlipFromLeft completion:nil];

        }

    }

    -(void)test1

    {

        [UIView animateWithDuration:2 animations:^{

            self.aView.center=CGPointMake(300, 300);//设置动画的结束状态

        } completion:^(BOOL finished) {

            NSLog(@"js");

        }];

    }

    -(void)test

    {

        [UIView beginAnimations:nil context:nil];

        [UIView setAnimationDuration:2];

        //self.aView.alpha=0;

        // self.aView.center=CGPointMake(300, 300);

        // self.aView.backgroundColor=[UIColor redColor];

        [UIView setAnimationDelegate:self];

        self.aView.bounds=CGRectMake(0, 100, 10, 10);

        [UIView setAnimationDidStopSelector:@selector(stop)];

        

        

        

        [UIView commitAnimations];

    }

    -(void)stop

    {

        NSLog(@"jieshu");

    }

    - (void)viewDidLoad {

        

    //    _showView=[[UIView alloc]initWithFrame:CGRectMake(100, 100, 200, 200)];

    //    // _showView.backgroundColor=[UIColor yellowColor];

    //    _fromView=[[UIView alloc]initWithFrame:_showView.bounds];

    //    _fromView.backgroundColor=[UIColor blueColor];

    //    

    //    _toView=[[UIView alloc]initWithFrame:_showView.bounds];

    //    

    //    _toView.backgroundColor=[UIColor redColor];

    //    

    //    

    //    [self.view addSubview:_showView];

    //   // [_showView addSubview:_toView];

    //    

    //    [_showView addSubview:_fromView];

        

        

        

    //    CALayer *calayer=[CALayer new];

    //    calayer.backgroundColor=[UIColor orangeColor].CGColor;

    //    calayer.bounds=CGRectMake(100, 100, 200,200);

    //    [self.view.layer addSublayer:calayer];

        

        

        NSLog(@"====%@",self.view.layer.sublayers);

        NSLog(@"---%@",self.view.subviews);

        [super viewDidLoad];

        // Do any additional setup after loading the view, typically from a nib.

    }

    - (void)didReceiveMemoryWarning {

        [super didReceiveMemoryWarning];

        // Dispose of any resources that can be recreated.

    }

    @end

  • 相关阅读:
    Debian安装autoconf
    Linux 解决 bash ./ 没有那个文件或目录 的方法
    C语言strtok()函数:字符串分割
    java.util.logging.Logger使用详解 (转)
    java中Logger.getLogger(Test.class)
    jquery ajax中success与complete的执行顺序 (转)
    navicat如何导入sql文件和导出sql文件
    MySQL修改root密码的多种方法(转)
    查看三种MySQL字符集的方法(转)
    mysql 5.7.13 安装配置方法图文教程(linux) (转)
  • 原文地址:https://www.cnblogs.com/linximu/p/4414363.html
Copyright © 2020-2023  润新知