ios7 UIAnimation
2013-11-17 22:57
176 查看
//视图1
UIView *rootview01 = [[UIView alloc]init];
rootview01.tag = 101;
rootview01.frame = CGRectMake(0, 20, 320, 460);
rootview01.backgroundColor = [UIColor greenColor];
[self.window addSubview:rootview01];
[rootview01 release];
//视图1上的按钮
UIButton *btn01 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
btn01.frame =CGRectMake(100, 200, 80, 40);
[btn01 setTitle:@"视图一" forState:UIControlStateNormal];
[btn01 addTarget:self action:@selector(pressBtn01) forControlEvents:UIControlEventTouchUpInside];
[rootview01 addSubview:btn01];
//视图2
UIView *rootview02 = [[UIView alloc]init];
rootview02.tag = 102;
rootview02.frame = CGRectMake(320, 20, 320, 460);
rootview02.backgroundColor = [UIColor blueColor];
[self.window addSubview:rootview02];
[rootview02 release];
//视图2上的按钮
UIButton *btn02 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
btn02.frame =CGRectMake(100, 200, 80, 40);
[btn02 setTitle:@"视图二" forState:UIControlStateNormal];
[btn02 addTarget:self action:@selector(pressBtn02) forControlEvents:UIControlEventTouchUpInside];
[rootview02 addSubview:btn02];
//视图3
UIView *rootview03 = [[UIView alloc]init];
rootview03.tag = 103;
rootview03.frame = CGRectMake(0, -480, 320, 460);
rootview03.backgroundColor = [UIColor yellowColor];
[self.window addSubview:rootview03];
[rootview03 release];
//视图3上的按钮
UIButton *btn03 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
btn03.frame =CGRectMake(100, 200, 80, 40);
[btn03 setTitle:@"视图三" forState:UIControlStateNormal];
[btn03 addTarget:self action:@selector(pressBtn03)forControlEvents:UIControlEventTouchUpInside];
[rootview03 addSubview:btn03];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
-(void)pressBtn01
{
UIView *rootView01 = [self.window viewWithTag:101];
UIView *rootView02 = [self.window viewWithTag:102];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.5];
rootView01.frame = CGRectMake(-320, 20, 320, 460);
rootView02.frame = CGRectMake(0, 20, 320, 460);
[UIView commitAnimations];
}
-(void)pressBtn02
{
UIView *rootView02 = [self.window viewWithTag:102];
UIView *rootView03 = [self.window viewWithTag:103];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.5];
rootView02.frame = CGRectMake(0, 480, 320, 460);
rootView03.frame = CGRectMake(0, 20, 320, 460);
[UIView commitAnimations];
}-(void)pressBtn03
{
UIView *rootView03 = [self.window viewWithTag:103];
[rootView03 removeFromSuperview];
}
UIView *rootview01 = [[UIView alloc]init];
rootview01.tag = 101;
rootview01.frame = CGRectMake(0, 20, 320, 460);
rootview01.backgroundColor = [UIColor greenColor];
[self.window addSubview:rootview01];
[rootview01 release];
//视图1上的按钮
UIButton *btn01 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
btn01.frame =CGRectMake(100, 200, 80, 40);
[btn01 setTitle:@"视图一" forState:UIControlStateNormal];
[btn01 addTarget:self action:@selector(pressBtn01) forControlEvents:UIControlEventTouchUpInside];
[rootview01 addSubview:btn01];
//视图2
UIView *rootview02 = [[UIView alloc]init];
rootview02.tag = 102;
rootview02.frame = CGRectMake(320, 20, 320, 460);
rootview02.backgroundColor = [UIColor blueColor];
[self.window addSubview:rootview02];
[rootview02 release];
//视图2上的按钮
UIButton *btn02 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
btn02.frame =CGRectMake(100, 200, 80, 40);
[btn02 setTitle:@"视图二" forState:UIControlStateNormal];
[btn02 addTarget:self action:@selector(pressBtn02) forControlEvents:UIControlEventTouchUpInside];
[rootview02 addSubview:btn02];
//视图3
UIView *rootview03 = [[UIView alloc]init];
rootview03.tag = 103;
rootview03.frame = CGRectMake(0, -480, 320, 460);
rootview03.backgroundColor = [UIColor yellowColor];
[self.window addSubview:rootview03];
[rootview03 release];
//视图3上的按钮
UIButton *btn03 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
btn03.frame =CGRectMake(100, 200, 80, 40);
[btn03 setTitle:@"视图三" forState:UIControlStateNormal];
[btn03 addTarget:self action:@selector(pressBtn03)forControlEvents:UIControlEventTouchUpInside];
[rootview03 addSubview:btn03];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
-(void)pressBtn01
{
UIView *rootView01 = [self.window viewWithTag:101];
UIView *rootView02 = [self.window viewWithTag:102];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.5];
rootView01.frame = CGRectMake(-320, 20, 320, 460);
rootView02.frame = CGRectMake(0, 20, 320, 460);
[UIView commitAnimations];
}
-(void)pressBtn02
{
UIView *rootView02 = [self.window viewWithTag:102];
UIView *rootView03 = [self.window viewWithTag:103];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.5];
rootView02.frame = CGRectMake(0, 480, 320, 460);
rootView03.frame = CGRectMake(0, 20, 320, 460);
[UIView commitAnimations];
}-(void)pressBtn03
{
UIView *rootView03 = [self.window viewWithTag:103];
[rootView03 removeFromSuperview];
}
相关文章推荐
- POJ1947 - Rebuilding Roads(树形DP)
- 23-Java中的反编译工具JDGUI
- Qt ui在程序中的使用方式
- 学霸系统ui部分软件发布说明
- How to find second highest or maximum salary of Employee in SQL - Interview question
- Top 10 Collection Interview Questions Answers in Java
- Top 10 Java Serialization Interview Questions and Answers
- Json::Value使用心得
- mr中对于key value组合的特殊处理
- 步步入佳境---UI入门(4) --简单练习
- ueditor与七牛云存储结合
- priority_queue的用法
- ip协议(转)
- ICMP(转)
- xcode编译时,有第三方库时,编译设置build active architecture only问题
- 并发包中的BlockingQueue这个类的介绍及使用
- break,continue,return的区别
- 错误:org.hibernate.PropertyValueException:not-null property references a null or transient value
- remapResults="true"
- 对<String,Double>类型的Map根据Value数值由大到小排序