自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

詳解IPhone動(dòng)畫效果類型及實(shí)現(xiàn)方法

移動(dòng)開發(fā) iOS
本文介紹的是詳解IPhone動(dòng)畫效果類型及實(shí)現(xiàn)方法,主要是實(shí)現(xiàn)iphone中的動(dòng)畫效果,先來看內(nèi)容詳解。

詳解IPhone動(dòng)畫效果類型及實(shí)現(xiàn)方法是本文要介紹的內(nèi)容,主要介紹了iphone動(dòng)畫的實(shí)現(xiàn)方法,不多說,我們一起來看內(nèi)容。

實(shí)現(xiàn)iphone漂亮的動(dòng)畫效果主要有兩種方法,一種是UIView層面的,一種是使用CATransition進(jìn)行更低層次的控制.

1、UIView

  1. CGContextRef context = UIGraphicsGetCurrentContext();  
  2. [UIView beginAnimations:nil context:context];  
  3. [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];  
  4. [UIView setAnimationDelegate:self];  
  5. [UIView setAnimationDuration:1.0];          //動(dòng)畫持續(xù)的時(shí)間  
  6.  
  7. //這里添加你對(duì)UIView所做改變的代碼  
  8.  
  9. //[UIView setAnimationDidStopSelector:@selector(animationFinished:)];   //動(dòng)畫停止后,執(zhí)行某個(gè)方法  
  10. [UIView commitAnimations]; 

2、UIView(使用Cocoa Touch)

  1. CGContextRef context = UIGraphicsGetCurrentContext();  
  2. [UIView beginAnimations:nil context:context];  
  3. [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];  
  4. [UIView setAnimationDuration:1.0];  
  5.  
  6. // Cocoa Touch    
  7. [UIView setAnimationTransition: UIViewAnimationTransitionCurlUp forView:myView cache:YES];  
  8.  
  9. [UIView setAnimationDelegate:self];  
  10. //[UIView setAnimationDidStopSelector:@selector(animationFinished:)]; //動(dòng)畫停止后,執(zhí)行某個(gè)方法  
  11. [UIView commitAnimations];  
  12. 動(dòng)畫方式(UIViewAnimationTransition):  
  13.     UIViewAnimationTransitionFlipFromLeft              //從左向右翻轉(zhuǎn)  
  14.     UIViewAnimationTransitionFlipFromRight             //從右向左翻轉(zhuǎn)  
  15.     UIViewAnimationTransitionCurlUp                    //從下向上翻頁  
  16.     UIViewAnimationTransitionCurlDown                  //從上向下翻頁 

3、CATransition

  1. CATransition *animation = [CATransition animation];  
  2.      animation.delegate = self;  
  3.      animation.duration = 1.0f;       //動(dòng)畫執(zhí)行時(shí)間  
  4.      animation.timingFunction = UIViewAnimationCurveEaseInOut;  
  5.      animation.type = kCATransitionFade;  
  6.      animation.subtype = kCATransitionFromRight;  
  7.       
  8. // 這里添加你對(duì)UIView所做改變的代碼  
  9.  
  10. [[myView layer] addAnimation:animation forKey:@"animation"]; 

setType:有四種類型:

  1. kCATransitionFade                   //交叉淡化過渡                     
  2. kCATransitionMoveIn               //移動(dòng)覆蓋原圖                     
  3. kCATransitionPush                    //新視圖將舊視圖推出去                     
  4. kCATransitionReveal                //底部顯出來     

setSubtype:有四種類型:

  1. kCATransitionFromRight;                     
  2. kCATransitionFromLeft(默認(rèn)值)                     
  3. kCATransitionFromTop;                     
  4. kCATransitionFromBottom          
  5. 注:kCATransitionFade 不支持Subtype      

4、CATransition(只使用setType,參數(shù)是NSString)    

  1. CATransition *animation = [CATransition animation];      
  2.  animation.delegate = self;       
  3.  animation.duration = 1.0f;   //動(dòng)畫執(zhí)行時(shí)間       
  4.  animation.timingFunction = UIViewAnimationCurveEaseInOut;       
  5.  animation.type = @"suckEffect";// 這里添加你對(duì)UIView所做改變的代碼       
  6.  [[myView layer] addAnimation:animation forKey:@"animation"];     

可以用的效果主要有:

  1. pageCurl     //向上翻一頁       
  2. pageUnCurl   //向下翻一頁        
  3. rippleEffect   //滴水效果        
  4. suckEffect     //收縮效果,如一塊布被抽走     
  5. cube       //立方體效果      
  6. oglFlip      //上下翻轉(zhuǎn)效果 

小結(jié):詳解IPhone動(dòng)畫效果類型及實(shí)現(xiàn)方法的內(nèi)容介紹完了,希望本文對(duì)你有所幫助!

責(zé)任編輯:zhaolei 來源: 互聯(lián)網(wǎng)
相關(guān)推薦

2011-07-08 10:15:15

IPhone 動(dòng)畫

2011-08-12 14:04:53

iPhone動(dòng)畫

2011-08-16 18:13:42

IPhone開發(fā)UIView動(dòng)畫

2011-08-10 14:40:23

iPhone動(dòng)畫

2011-08-09 13:50:01

iPhone動(dòng)畫UIView

2012-06-04 14:47:42

HTML5

2011-07-08 15:08:16

iPhone 圖片

2017-02-06 13:00:49

Android翻轉(zhuǎn)卡片動(dòng)畫效果

2009-09-15 16:08:00

2012-05-22 09:21:10

數(shù)據(jù)中心PUEFacebook數(shù)據(jù)中

2012-05-21 14:36:18

Facebook開源

2011-08-15 13:50:06

IPhone開發(fā)UIView動(dòng)畫

2011-07-20 15:20:14

IPhone AVAudioRec

2011-08-22 14:21:24

iPhone開發(fā)UIView Anim

2011-05-30 13:23:11

Android 動(dòng)畫

2011-07-22 18:20:04

IOS View 動(dòng)畫

2022-03-29 11:28:24

HarmonyOS動(dòng)畫css

2011-07-28 10:11:54

iPhone開發(fā) 備忘

2011-08-08 10:42:46

iPhone UITableVie 分頁

2016-09-12 14:07:14

Android 定時(shí)器
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)