transitionFromView方法的使用
transitionFromView方法的使用
效果
源码
//
// ViewController.m
// TransitionFromView
//
// Created by YouXianMing on 16/5/30.
// Copyright © 2016年 YouXianMing. All rights reserved.
// #import "ViewController.h" typedef enum : NSUInteger { kBottomView = ,
kTopView, } EViewControllerTag; @interface ViewController () { UIView *redView;
UIView *yellowView;
UIView *containerView;
} @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // ContainerView
containerView = [[UIView alloc] initWithFrame:CGRectMake(, , , )];
containerView.center = self.view.center;
[self.view addSubview:containerView]; // BottomView
redView = [[UIView alloc] initWithFrame:containerView.bounds];
redView.tag = kBottomView;
redView.backgroundColor = [UIColor redColor];
[containerView addSubview:redView]; // TopView
yellowView = [[UIView alloc] initWithFrame:containerView.bounds];
yellowView.tag = kTopView;
yellowView.backgroundColor = [UIColor yellowColor];
[containerView addSubview:yellowView]; // Button
UIButton *button = [[UIButton alloc] initWithFrame:self.view.bounds];
[button addTarget:self action:@selector(buttonEvent:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button];
} - (void)buttonEvent:(UIButton *)button { button.enabled = NO; [UIView transitionFromView:[containerView viewWithTag:kTopView]
toView:[containerView viewWithTag:kBottomView]
duration:0.5f
options:UIViewAnimationOptionTransitionFlipFromLeft
completion:^(BOOL finished) { button.enabled = YES; if ([[containerView viewWithTag:kBottomView] isEqual:redView]) { [containerView insertSubview:yellowView belowSubview:redView];
redView.tag = kTopView;
yellowView.tag = kBottomView; } else { [containerView insertSubview:redView belowSubview:yellowView];
redView.tag = kBottomView;
yellowView.tag = kTopView;
}
}];
} @end
细节
transitionFromView方法的使用的更多相关文章
- UIView 的transitionFromView方法实现视图切换
#import "ViewController.h" @interface ViewController () @property (strong, nonatomic) IBOu ...
- iOS UIKit:animation
@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css); @import url(/ ...
- javaSE27天复习总结
JAVA学习总结 2 第一天 2 1:计算机概述(了解) 2 (1)计算机 2 (2)计算机硬件 2 (3)计算机软件 2 (4)软件开发(理解) 2 (5) ...
- UIView属性及方法
@property(nonatomic) CGFloat alpha //设置视图的透明度 //透明度的设置从最小0.0到1.0 ,1.0为完全不透明, //其中这个属性只影响当前视图,并不会影响其子 ...
- iOS开发UUIView动画方法总结
#动画设置 UIView动画实现 @interface ViewController () @property (weak, nonatomic) IBOutlet UIView *myView; @ ...
- UIView封装动画--iOS利用系统提供方法来做转场动画
UIView封装动画--iOS利用系统提供方法来做转场动画 UIViewAnimationOptions option; if (isNext) { option=UIViewAnimationOpt ...
- mapreduce多文件输出的两方法
mapreduce多文件输出的两方法 package duogemap; import java.io.IOException; import org.apache.hadoop.conf ...
- 【.net 深呼吸】细说CodeDom(6):方法参数
本文老周就给大伙伴们介绍一下方法参数代码的生成. 在开始之前,先补充一下上一篇烂文的内容.在上一篇文章中,老周检讨了 MemberAttributes 枚举的用法,老周此前误以为该枚举不能进行按位操作 ...
- IE6、7下html标签间存在空白符,导致渲染后占用多余空白位置的原因及解决方法
直接上图:原因:该div包含的内容是靠后台进行print操作,输出的.如果没有输出任何内容,浏览器会默认给该空白区域添加空白符.在IE6.7下,浏览器解析渲染时,会认为空白符也是占位置的,默认其具有字 ...
随机推荐
- javaweb笔记三
//写了注解,就不用在web.xml里进行注册@WebServlet(urlPatterns="/my",name="my",loadOnStartup=1,i ...
- Select查询语句1
一.语法结构 select[all|distinct]select_list from table_name[join join_condition] where search_condition g ...
- [转] 钉钉的H5性能优化方案
对于一个H5的产品,功能无疑很重要,但是性能同样是用户体验中不可或缺的一环.原本H5的渲染性能就不及native的app,如果不把性能优化做起来,将极大地影响用户使用产品的积极性. 用户感受 当用户能 ...
- 解决 Delphi XE5 写Android程序的No resource identifier found for attribute... 错误【转】
原文:http://www.hxhlb.cn/article/32142aaeb67bbc05379369c3.html 那一天,我装上了RAD Studio XE5. 当天晚上,我就写了一个小小的A ...
- 【AtCoder】ARC103
C - //// 为了防止一些多余的判断,我选择直接记录每个数的个数,然后枚举第一个数,找第一个数之外第二个数改变最少的情况下应该选什么 代码 #include <bits/stdc++.h&g ...
- 017.Zabbix宏介绍
一 宏介绍 Zabbix宏的作用是便于在模板.Items.Trigger中的引用,名称为{$名称},宏的字符范围为:A~Z/0~9/_. 如:net.tcp.service[ssh,{$SSH_POR ...
- Harbor 企业级镜像仓库搭建
Habor是由VMWare公司开源的容器镜像仓库.事实上,Habor是在Docker Registry上进行了相应的 企业级扩展,从而获得了更加广泛的应用,这些新的企业级特性包括:管理用户界面,基于角 ...
- 【BZOJ-3456】城市规划 CDQ分治 + NTT
题目链接 http://www.lydsy.com/JudgeOnline/problem.php?id=3456 Solution 这个问题可以考虑dp,利用补集思想 N个点的简单图总数量为$2^{ ...
- Codeforces Round #370 (Div. 2) D. Memory and Scores 动态规划
D. Memory and Scores 题目连接: http://codeforces.com/contest/712/problem/D Description Memory and his fr ...
- 2013-2014 ACM-ICPC, NEERC, Southern Subregional Contest Problem H. Password Service dp
Problem H. Password Service 题目连接: http://www.codeforces.com/gym/100253 Description Startups are here ...