国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

[iOSUI進階-6.3]UIView動畫

2019-11-14 19:38:45
字體:
來源:轉載
供稿:網友
1.UIView轉場過渡動畫
UIViewTransitionAnimation
 
 1 // 2 //  ViewController.m 3 //  UIViewAnimationTest 4 // 5 //  Created by hellovoidworld on 15/1/16. 6 //  Copyright (c) 2015年 hellovoidworld. All rights reserved. 7 // 8  9 #import "ViewController.h"10 11 @interface ViewController ()12 13 @PRoperty(nonatomic, strong) UIImageView *imageView;14 @property(nonatomic, assign) int imageIndex;15 16 @end17 18 @implementation ViewController19 20 - (void)viewDidLoad {21     [super viewDidLoad];22     // Do any additional setup after loading the view, typically from a nib.23    24     UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(80, 100, 160, 240)];25     imageView.image = [UIImage imageNamed:@"1"];26     self.imageView = imageView;27    28     [self.view addSubview:imageView];29    30 }31 32 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {33     self.imageIndex++;34     if (self.imageIndex == 3) {35         self.imageIndex = 0;36     }37    38     // 指定需要轉換動畫的控件和動畫轉換內容39     [UIView transitionWithView:self.imageView duration:1.0 options:UIViewAnimationOptionTransitionFlipFromTop animations:^{40             self.imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"%d", self.imageIndex+1]];41     } completion:nil];42 43 }44 @end

 

 
 
2.UIView替換view動畫
UIViewTransitionFromAnimation
1  2     // 帶動畫替換view3     [UIView transitionFromView:self.view toView:self.imageView duration:1.0 options:UIViewAnimationOptionTransitionFlipFromTop completion:nil];

 

 
 
 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 甘洛县| 苏尼特左旗| 革吉县| 河东区| 旺苍县| 德清县| 平湖市| 东莞市| 广昌县| 苍梧县| 临潭县| 阿合奇县| 齐齐哈尔市| 渝北区| 昆明市| 海晏县| 文山县| 松阳县| 盐池县| 郁南县| 仪征市| 兴隆县| 新建县| 丰都县| 庆安县| 林周县| 堆龙德庆县| 古丈县| 金门县| 习水县| 岚皋县| 普兰县| 弥渡县| 淅川县| 万州区| 东方市| 文水县| 长沙县| 江口县| 自治县| 黄龙县|