最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

IOS 開發(fā)之UIView動(dòng)畫的實(shí)例詳解

 更新時(shí)間:2017年07月15日 16:03:14   作者:Hi_Aaron  
這篇文章主要介紹了IOS 開發(fā)之UIView動(dòng)畫的實(shí)例詳解的相關(guān)資料,需要的朋友可以參考下

IOS 動(dòng)畫實(shí)例詳解

iOS動(dòng)畫的實(shí)現(xiàn)方式多種多樣,這里就只記錄一下 beginAnimations:context 。

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

實(shí)現(xiàn)效果圖:

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

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

以上就是關(guān)于IOS動(dòng)畫開發(fā)的實(shí)例,本站對于IOS 開發(fā)還有很多教程,大家可以搜索查閱!

相關(guān)文章

  • iOS開發(fā)實(shí)現(xiàn)隨機(jī)圖片驗(yàn)證碼封裝

    iOS開發(fā)實(shí)現(xiàn)隨機(jī)圖片驗(yàn)證碼封裝

    這篇文章主要介紹了iOS開發(fā)實(shí)現(xiàn)隨機(jī)圖片驗(yàn)證碼封裝,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2017-08-08
  • iOS實(shí)現(xiàn)波浪效果

    iOS實(shí)現(xiàn)波浪效果

    這篇文章主要為大家詳細(xì)介紹了iOS實(shí)現(xiàn)波浪效果,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-05-05
  • IOS TextFiled與TextView 鍵盤的收起以及處理鍵盤遮擋

    IOS TextFiled與TextView 鍵盤的收起以及處理鍵盤遮擋

    這篇文章主要介紹了IOS TextFiled與TextView 鍵盤的收起以及處理鍵盤遮擋的相關(guān)資料,需要的朋友可以參考下
    2016-12-12
  • ios app重提提交審核流程

    ios app重提提交審核流程

    本篇文章給大家講述了在APP第一次沒有審核通過后,重新提交的流程和注意的地方,學(xué)習(xí)一下吧。
    2017-12-12
  • iOS實(shí)現(xiàn)UITableView左滑刪除復(fù)制即用功能

    iOS實(shí)現(xiàn)UITableView左滑刪除復(fù)制即用功能

    這篇文章主要介紹了iOS實(shí)現(xiàn)UITableView左滑刪除復(fù)制即用功能,在項(xiàng)目開發(fā)中經(jīng)常會(huì)用到這樣的需求,下面小編把實(shí)現(xiàn)代碼分享給大家,需要的朋友可以參考下
    2017-09-09
  • iOS 底部按鈕和應(yīng)用圖標(biāo)顯示未讀消息(帶數(shù)字)

    iOS 底部按鈕和應(yīng)用圖標(biāo)顯示未讀消息(帶數(shù)字)

    本文主要介紹了iOS 底部按鈕和應(yīng)用圖標(biāo)顯示未讀消息的相關(guān)知識(shí)。具有很好的參考價(jià)值。下面跟著小編一起來看下吧
    2017-04-04
  • iOS中排列組合算法的使用小結(jié)

    iOS中排列組合算法的使用小結(jié)

    這篇文章主要給大家介紹了關(guān)于iOS中排列組合算法使用的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2018-09-09
  • iOS實(shí)現(xiàn)音頻進(jìn)度條效果

    iOS實(shí)現(xiàn)音頻進(jìn)度條效果

    這篇文章主要介紹了ios實(shí)現(xiàn)音頻進(jìn)度條效果,本文寫了一個(gè)小demo通過實(shí)例代碼相結(jié)合的形式給大家詳細(xì)介紹,需要的朋友可以參考下
    2018-10-10
  • iOS開發(fā)項(xiàng)目- 基于WebSocket的聊天通訊(1)

    iOS開發(fā)項(xiàng)目- 基于WebSocket的聊天通訊(1)

    這篇文章主要介紹了iOS開發(fā)項(xiàng)目- 基于WebSocket的聊天通訊,WebSocket是web通信方式的一種,有需要的可以了解一下。
    2016-11-11
  • iOS中l(wèi)ebel特殊字符的自動(dòng)換行問題解決

    iOS中l(wèi)ebel特殊字符的自動(dòng)換行問題解決

    這篇文章主要給大家介紹了關(guān)于iOS中l(wèi)ebel特殊字符的實(shí)現(xiàn)不自動(dòng)換行的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家學(xué)習(xí)iOS具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧。
    2017-10-10

最新評論

黄平县| 兰溪市| 苏尼特右旗| 昆山市| 聂拉木县| 阿拉善盟| 阿尔山市| 汉阴县| 姚安县| 栾川县| 灌阳县| 平舆县| 南投县| 庆城县| 武乡县| 淮滨县| 隆化县| 仙游县| 姚安县| 额敏县| 监利县| 苍梧县| 香港 | 荣成市| 周口市| 海南省| 福泉市| 西宁市| 缙云县| 开平市| 亚东县| 汉中市| 如皋市| 广州市| 潼关县| 吉林省| 宣化县| 平邑县| 昌邑市| 长沙县| 汤原县|