ios7 UIAnimation

 //视图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];
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

凝望星辰

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值