中文字幕第五页-中文字幕第页-中文字幕韩国-中文字幕最新-国产尤物二区三区在线观看-国产尤物福利视频一区二区

IOS開發之UIView動畫的示例分析-創新互聯

這篇文章將為大家詳細講解有關IOS開發之UIView動畫的示例分析,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。

網站建設哪家好,找創新互聯公司!專注于網頁設計、網站建設、微信開發、微信小程序、集團企業網站建設等服務項目。為回饋新老客戶創新互聯還提供了延平免費建站歡迎大家使用!

IOS 動畫實例詳解

iOS動畫的實現方式多種多樣,這里就只記錄一下 beginAnimations:context 。

在你調用 beginAnimations:context:方法來啟動一個動畫后,動畫并不會立即被執行,直 到你調用 UIView 類的 commitAnimations 類方法。你對一個視圖對象執行的介于 beginAnimations:context:方法跟 commitAnimations方法之間的操作(例如移動)會在 commitAnimations 被執行后才會生效 。

實現效果圖:

IOS開發之UIView動畫的示例分析IOS開發之UIView動畫的示例分析

代碼很簡單,直接貼了,如下:

// 
// ViewController.m 
// Graphics 
// 
// Created by aaron on 14b-5-29. 
// Copyright (c) 2014年 The Technology Studio. All rights reserved. 
// 
 
#import "ViewController.h" 
 
@interface ViewController () 
@property(nonatomic,strong) UIImageView *imageView1; 
@property(nonatomic,strong) UIImageView *imageView2; 
 
@end 
 
@implementation ViewController 
 
- (void)viewDidLoad 
{ 
  [super viewDidLoad]; 
   
  UIImage *image = [UIImage imageNamed:@"1.png"]; 
  self.imageView1 = [[UIImageView alloc] initWithImage:image]; 
  self.imageView2 = [[UIImageView alloc] initWithImage:image]; 
  [self.imageView1 setFrame:CGRectMake(0.0f, 
                     0.0f, 
                     100.0f, 
                     100.0f)]; 
   
  [self.imageView2 setFrame:CGRectMake(220.0f, 
                     350.0f, 
                     100.0f, 
                     100.0f)]; 
  [self.view addSubview:self.imageView1]; 
  [self.view addSubview:self.imageView2]; 
   
//  [self startTopLeftImageViewAnimation]; 
//  [self startBottomRightViewAnimationAfterDelay:2]; 
  [self affineTransformScaleAnimation]; 
  [self affineTransformRotateAnimation]; 
   
} 
 
//imageView2 animation 
-(void)startTopLeftImageViewAnimation{ 
  [self.imageView1 setFrame:CGRectMake(0.0f, 
                     0.0f, 
                     100.0f, 
                     100.0f)]; 
  [self.imageView1 setAlpha:1.0f]; 
  [UIView beginAnimations:@"imageView1Animation" context:(__bridge void*)self.imageView1]; 
  [UIView setAnimationDuration:3.0f]; 
  [UIView setAnimationDelegate:self]; 
  [UIView setAnimationDidStopSelector:@selector(imageViewDidStop:finished:context:)]; 
  [self.imageView1 setFrame:CGRectMake(220.0f, 350.0f, 100.0f, 100.0f)]; 
  [self.imageView1 setAlpha:0.0f]; 
  [UIView commitAnimations]; 
} 
 
-(void)imageViewDidStop:(NSString*)paramAnimationID finished:(NSNumber*)paramFinished context:(void*)paramContext{ 
  NSLog(@"AnimationID = %@\n",paramAnimationID); 
  UIImageView *contextImageView = (__bridge UIImageView *)(paramContext); 
  NSLog(@"contextImageView = %@",contextImageView); 
  [contextImageView removeFromSuperview]; 
} 
 
 
//imageView2 animation 
-(void)startBottomRightViewAnimationAfterDelay:(CGFloat)paramDelay{ 
  [self.imageView2 setFrame:CGRectMake(220.0f, 
                     350.0f, 
                     100.0f, 
                     100.0f)]; 
  [self.imageView2 setAlpha:1.0f]; 
  [UIView beginAnimations:@"imageView2Animation" context:(__bridge voidvoid *)(self.imageView2)]; 
  [UIView setAnimationDuration:3.0f]; 
  [UIView setAnimationDelay:paramDelay]; 
  [UIView setAnimationDelegate:self]; 
  [UIView setAnimationDidStopSelector:@selector(imageViewDidStop:finished:context:)]; 
  [self.imageView2 setFrame:CGRectMake(0.0f, 0.0f, 100.0f, 100.0f)]; 
  [self.imageView2 setAlpha:0.0f]; 
  [UIView commitAnimations]; 
} 
 
 
//imageView1 AffineTransformScale animation 
-(void)affineTransformScaleAnimation{ 
  self.imageView1.center = self.view.center; 
  self.imageView1.transform = CGAffineTransformIdentity; 
  [UIView beginAnimations:nil context:NULL]; 
  [UIView setAnimationDuration:5.0f]; 
  self.imageView1.transform = CGAffineTransformMakeScale(2.0f, 2.0f); 
  [self.imageView1 setAlpha:0.0f]; 
  [UIView commitAnimations]; 
} 
 
//imageView2 AffineTransformRotate animation 
-(void)affineTransformRotateAnimation{ 
  self.imageView2.center = self.view.center; 
  [UIView beginAnimations:@"clockwiseAnimation" context:NULL]; 
  [UIView setAnimationDuration:5.0f]; 
  [UIView setAnimationDelegate:self]; 
  [UIView setAnimationDidStopSelector:@selector(clockwiseRotationStopped:finished:context:)]; 
  self.imageView2.transform = CGAffineTransformMakeRotation(90.0f*M_PI/180.f); 
  [UIView commitAnimations]; 
} 
 
 
-(void)clockwiseRotationStopped:(NSString*)paramAnimationID finished:(NSNumber*)paramFinished context:(void*)paramContext{ 
  [UIView beginAnimations:@"counterclockwiseAnimation" context:NULL]; 
  [UIView setAnimationDuration:5.0f]; 
  self.imageView2.transform = CGAffineTransformIdentity; 
  [UIView commitAnimations]; 
} 
 
@end

關于“IOS開發之UIView動畫的示例分析”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,使各位可以學到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。

另外有需要云服務器可以了解下創新互聯建站www.2m8n56k.cn,海內外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業上云的綜合解決方案,具有“安全穩定、簡單易用、服務可用性高、性價比高”等特點與優勢,專為企業上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。

分享名稱:IOS開發之UIView動畫的示例分析-創新互聯
本文地址:http://www.2m8n56k.cn/article22/dehicc.html

成都網站建設公司_創新互聯,為您提供網站維護手機網站建設網站改版企業建站企業網站制作響應式網站

廣告

聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:[email protected]。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯

成都seo排名網站優化
主站蜘蛛池模板: 欧美成人精品一区二区三区 | 操她视频网站 | 自偷自偷自亚洲永久 | 成人看片在线观看免费 | 日韩在线免费视频 | 成年免费在线观看 | 亚洲综合99| 久久久精品国产免费观看同学 | 日本作爱 | 精品久久久久久乐 | 亚洲一区二区免费视频 | 99视频精品免费99在线 | 日本一级aaaa特黄毛片 | 亚洲欧美视频一区二区 | 草草视频在线免费观看 | 国产高清视频免费观看 | 国产不卡毛片 | 久草视频2 | 国产大乳孕妇喷奶水在线观看 | 久久99这里只有精品国产 | 美女va| 很黄很暴力深夜爽爽无遮挡 | 国产乱子伦真实china | 久久久www免费人成看片 | 国产三级做爰高清视频a | 女人把腿劈开让男人桶的网站 | 99在线观看 | 亚洲在线免费观看 | 一级毛片在线视频 | 亚洲一级毛片免费观看 | 亚洲线精品久久一区二区三区 | 97在线观看| 天天看夜夜操 | 一级毛片真人免费播放视频 | 91精品国产免费久久国语蜜臀 | 亚洲日本视频 | 91精品国产91久久久久久青草 | 亚洲免费专区 | 韩国精品视频在线观看 | 荡女妇边被c边呻吟久久 | 美女张开大腿让男人桶 |