码迷,mamicode.com
首页 > 其他好文 > 详细

(5.17)简单动画

时间:2014-05-19 19:32:19      阅读:236      评论:0      收藏:0      [点我收藏+]

标签:style   c   ext   color   int   a   

- (IBAction)button:(UIButton *)sender {
    
    
     if (sender.tag == 0) {
         
    //计算view的frame属性
        NSString *frame = NSStringFromCGRect(_view1.frame);
        NSString *outframe = [NSString stringWithFormat:@"frame:%@",frame];
        [_message setText:outframe];

    }else if(sender.tag == 1){
      //计算view的bounds属性
        NSString *bounds = NSStringFromCGRect(_view1.bounds);
        NSString *outbounds = [NSString stringWithFormat:@"bounds:%@",bounds];
        [_message setText:outbounds];
        
    }else if(sender.tag == 2){
        //计算view的center属性
        NSString *center = NSStringFromCGPoint(_view1.center);
        NSString *outcenter = [NSString stringWithFormat:@"center:%@",center];
        [_message setText:outcenter];
        
    }else if (sender.tag == 3){
       //图像角度转向
        CGAffineTransform tranR =CGAffineTransformRotate(_view1.transform, M_PI_4);
 //早期的动画实现
//        //设定动画效果
//        [UIView beginAnimations:nil context:nil];
//        //设定动画时间长度
//        [UIView setAnimationDuration:1.0];
//        
//        [_view1 setTransform:tranR];
//        //  提交动画效果
//        [UIView commitAnimations];
//
        
    //block动画方法
        [UIView animateWithDuration:(1.0f) animations:^{
             [_view1 setTransform:tranR];
        }];

        
    }else if(sender.tag == 4){
        //图像放大
        CGAffineTransform tranS = CGAffineTransformScale(_view1.transform, 1.2, 1.2);
       //block动画方法
        [UIView animateWithDuration:(1.0f) animations:^{
            [_view1 setTransform:tranS];
        }];
        

    
    }else if(sender.tag == 5){
        //图像缩小
        CGAffineTransform tranR = CGAffineTransformScale(_view1.transform, 1/1.2, 1/1.2);
        //block动画方法
        [UIView animateWithDuration:(1.0f) animations:^{
              [_view1 setTransform:tranR];
        }];

        
    }else if (sender.tag == 6){
       //图像平移
        CGAffineTransform tranM = CGAffineTransformTranslate(_view1.transform , 0, 20);
        
     //block动画方法的嵌套
        [UIView animateWithDuration:1.0f animations:^{
             [_view1 setTransform:tranM];
        } completion:^(BOOL finished) {
            [UIView animateWithDuration:1.0f animations:^{
                [_view1 setBackgroundColor:[UIColor redColor]];
                [_view1 setAlpha:0.1f];
            }];
        }];
        
        
    }
    
 
 
    
    
    
}
@end

(5.17)简单动画,布布扣,bubuko.com

(5.17)简单动画

标签:style   c   ext   color   int   a   

原文地址:http://www.cnblogs.com/modingding/p/3734592.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!