ios animate簡單動畫體驗

來源:互聯網
上載者:User

標籤:

  /*

===手勢=====

一、

    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      */

 

ios animate簡單動畫體驗

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.