成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

iPhone開發中關于UIView Animation實現效果

移動開發 iOS
iPhone開發中關于UIView Animation實現效果是本文要介紹的內容,主要是來學習UIView Animation一連串的實現效果,具體內容我們來看本文如何實現。

iPhone開發中關于UIView Animation實現效果是本文要介紹的內容,主要是來學習UIView Animation一連串的實現效果,具體內容我們來看本文如何實現。之前受某人影響以為一連串的UIView Animation 只能這么寫:

在某個animation 設置delegate ,然后在 delegate 函數中再調用另一個函數。

今天偷閑決定看 iPhone cookbook 代碼查漏補缺下,結果發現這代碼:

C代碼

  1. // Hide the bar button and show the view   
  2. self.navigationItem.rightBarButtonItem = nil;   
  3. [self.view viewWithTag:101].alpha = 1.0f;   
  4.  
  5. // Bounce to 115% of the normal size   
  6. [UIView beginAnimations:nil context:UIGraphicsGetCurrentContext()];   
  7. [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];   
  8. [UIView setAnimationDuration:0.4f];   
  9. [self.view viewWithTag:101].transform = CGAffineTransformMakeScale(1.15f, 1.15f);   
  10. [UIView commitModalAnimations];   
  11.  
  12. // Return back to 100%   
  13. [UIView beginAnimations:nil context:UIGraphicsGetCurrentContext()];   
  14. [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];   
  15. [UIView setAnimationDuration:0.3f];   
  16. [self.view viewWithTag:101].transform = CGAffineTransformMakeScale(1.0f, 1.0f);   
  17. [UIView commitModalAnimations];   
  18.  
  19. // Pause for a second and appreciate the presentation   
  20. [NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0f]];   
  21.  
  22. // Slowly zoom back down and hide the view   
  23. [UIView beginAnimations:nil context:UIGraphicsGetCurrentContext()];   
  24. [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];   
  25. [UIView setAnimationDuration:1.0f];   
  26. [self.view viewWithTag:101].transform = CGAffineTransformMakeScale(0.01f, 0.01f);   
  27. [UIView commitModalAnimations];   
  28.  
  29. // Restore the bar button   
  30. [self.view viewWithTag:101].alpha = 0.0f;  

tnnd 原來可以這么寫。

同時學到個新玩意。

C代碼

  1. [NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0f]];  

PS. 原來這個例子就叫做 Modal View Animation 罪過罪過,搞了這么久iPhone還不知道這東西。

抱歉,看錯了,原來是作者自己實現的方法,仔細一看原來

C代碼

  1. commitModalAnimations  

具體代碼實現是這樣的。

Java代碼

  1. @interface UIViewDelegate : NSObject   
  2. {   
  3. CFRunLoopRef currentLoop;   
  4. }   
  5. @end   
  6.  
  7. @implementation UIViewDelegate   
  8. -(id) initWithRunLoop: (CFRunLoopRef)runLoop   
  9. {   
  10. if (self = [super init]) currentLoop = runLoop;   
  11. return self;   
  12. }   
  13.  
  14. -(void) animationFinished: (id) sender   
  15. {   
  16. CFRunLoopStop(currentLoop);   
  17. }   
  18. @end   
  19.  
  20. @implementation UIView (ModalAnimationHelper)   
  21. + (void) commitModalAnimations   
  22. {   
  23. CFRunLoopRef currentLoop = CFRunLoopGetCurrent();   
  24.  
  25. UIViewDelegate *uivdelegate = [[UIViewDelegate alloc] initWithRunLoop:currentLoop];   
  26. [UIView setAnimationDelegate:uivdelegate];   
  27. [UIView setAnimationDidStopSelector:@selector(animationFinished:)];   
  28. [UIView commitAnimations];   
  29. CFRunLoopRun();   
  30. [uivdelegate release];   
  31. }   
  32. @end 

小結:iPhone開發中關于UIView Animation實現效果的內容介紹完了,希望通過本文的學習能對你有所幫助!

責任編輯:zhaolei 來源: 網易博客
相關推薦

2013-07-25 13:43:23

iOS開發學習UIView的Anim

2011-08-16 18:13:42

IPhone開發UIView動畫

2011-08-15 13:50:06

IPhone開發UIView動畫

2011-08-12 14:04:53

iPhone動畫

2011-08-12 11:31:46

iPhoneUIView動畫

2011-08-11 10:16:23

iPhoneUIView視圖

2011-08-11 10:27:37

iPhoneUIView視圖

2011-07-08 15:08:16

iPhone 圖片

2011-08-10 14:40:23

iPhone動畫

2011-07-08 10:15:15

IPhone 動畫

2011-08-09 17:12:30

iPhoneCFRunLoop

2011-07-29 13:27:48

iPhone 開發 Nib

2011-08-15 13:44:07

iPhone開發UITableView

2011-08-22 15:15:49

iPhone開發NSMutableAr排序

2011-08-18 15:24:40

iPhone國際化

2011-08-08 14:07:49

iPhone開發 字體

2011-08-15 09:58:25

iPhoneXib文件UITableView

2011-08-16 18:56:11

iPhone開發Three20

2011-07-26 14:18:20

2011-08-15 15:44:46

iPhone開發PDF
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 精品日韩 | 欧美日韩一区二区电影 | 在线成人免费视频 | 久久久久国 | 91一区二区三区在线观看 | 91精品中文字幕一区二区三区 | 国产精品久久久久久久午夜 | 国产精品自拍视频 | 久久精品欧美视频 | 婷婷去俺也去 | 国产日韩久久 | 一级毛片免费看 | 精品国产一区二区三区性色av | 精品国产18久久久久久二百 | 在线看亚洲 | www.一区二区三区.com | 日韩成人在线播放 | 国产99久久 | 欧美日韩黄 | 最新日韩av | 中文字幕1区2区3区 日韩在线视频免费观看 | 在线观看视频h | 中文字幕亚洲视频 | 极品在线| 一区二区三区视频在线观看 | 91色站| 久久不卡日韩美女 | 91免费在线| 天天天操操操 | 日韩成人在线免费视频 | 久久久久国产一区二区三区 | 久久这里有精品 | 亚洲性网 | 欧美二区在线 | 黄色片av | 日本在线视频一区二区 | 日本久久www成人免 成人久久久久 | 久久99精品久久久久久噜噜 | 国产精品毛片无码 | 日韩在线一区二区 | 在线一区视频 |