zoukankan      html  css  js  c++  java
  • 动画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

  • 相关阅读:
    Linux 常用命令之df du
    Liunx 命令之链接操作
    1、SpringBoot bean,list,map Json返回
    Echarts 柱状图配置详解
    layui table数据表格reload where参数保留问题
    Mac休眠后解决卡死转圈问题
    5、Storm集成Kafka
    使用OData技术遇到的问题及解决办法
    我的柔情你永远不懂...
    如果你知道时间的默认值...
  • 原文地址:https://www.cnblogs.com/linximu/p/4414363.html
Copyright © 2011-2022 走看看