ios animate简单动画体验

  /*

===手势=====

一、

    1、UISwipeGestureRecognizer 实例化一个手势 initWithTarget

    2、set手势滑向方向

    3、self.view 添加这个手势实例

   

    4、添加事件

二、

    轻点击

    UITapGestureRecognizer

    .numberOfTouchesRequire 手指数

    .numberOfTapsRequire 点击数

    [  requireGestureRecognizerToFail:] 事件冲突执行哪一个

   

 1  
 2     UISwipeGestureRecognizer *leftSwipe = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(leftSwipeAction)];
 3     [leftSwipe setDirection:UISwipeGestureRecognizerDirectionLeft];
 4     //[self.view addGestureRecognizer:leftSwipe];
 5     [self.imageViewDemao addGestureRecognizer:leftSwipe];
 6 
 7  UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapAction)];
 8     tapGesture.numberOfTouchesRequired = 1;
 9     tapGesture.numberOfTapsRequired = 1;
10     [self.imageViewDemao addGestureRecognizer:tapGesture];
11 
12 
13     UITapGestureRecognizer *tapGesture2 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapAction2)];
14     tapGesture2.numberOfTouchesRequired = 1;
15     tapGesture2.numberOfTapsRequired = 2;
16     [self.imageViewDemao addGestureRecognizer:tapGesture2];
17     
18     //UIGestureRecognizer 解决事件重叠过程
19     [tapGesture requireGestureRecognizerToFail:tapGesture2];

 

 

 

   

===简单动画(手势事件)====

--------- 一、

    1、动画开始

    [UIView beginAnimations:]

   

    2、动画设置

    setAnimationDuration 时间

    setAnimationTransition

   

  

   

    3、动画提交

    [UIView commitAnimations]

   

------- 二、

     CATransition (与CATransaction区别)

    1、实例化一个动画

    2、.type

       .subtype

    3、[self.view.layer addAnimation: forKey:]

    */

 

 1     CATransition *animation = [CATransition animation];
 2     animation.type = @"cube";
 3     animation.subtype = kCATransitionFromRight;
 4     [self.imageViewDemao.layer addAnimation:animation forKey:@"left"];
 5     self.i ++;
 6     if (self.i > 3)
 7     {
 8         self.i = 1;
 9     }
10     //self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:[NSString stringWithFormat:@"%d",self.i]]];
11     self.imageViewDemao.image = [UIImage imageNamed:[NSString stringWithFormat:@"%d",self.i]];
12     
13     
14     /*
15      //type:
16      ade     //交叉淡化过渡(不支持过渡方向)
17      push     //新视图把旧视图推出去
18      moveIn   //新视图移到旧视图上面
19      reveal   //将旧视图移开,显示下面的新视图
20      cube     //立方体翻滚效果--这个效果不错
21      oglFlip  //上下左右翻转效果
22      suckEffect   //收缩效果,如一块布被抽走(不支持过渡方向)
23      rippleEffect //滴水效果(不支持过渡方向)
24      pageCurl     //向上翻页效果
25      pageUnCurl   //向下翻页效果
26      cameraIrisHollowOpen  //相机镜头打开效果(不支持过渡方向)
27      cameraIrisHollowClose //相机镜头关上效果(不支持过渡方向)
28      
29      */

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。