您的位置:首页 > 产品设计 > UI/UE

UI组件缩放和旋转

2014-02-04 14:50 369 查看
旋转(注意:值是一个180°PI为单位)

#pragma mark 改变组件角度旋转
- (IBAction)rotationBlock:(UIButton *)sender {

    [UIView
beginAnimations:nil
context:nil];

    [UIView
setAnimationDuration:.8];
    //旋转开始
   
UIView *redBtn=[self.view
viewWithTag:kRedBtnTag];

    CGAffineTransform transForm=redBtn.transform;
    redBtn.transform=CGAffineTransformRotate(transForm, sender.tag==7?-M_PI_4:M_PI_4);

    [UIView
commitAnimations];
}
缩放

#pragma mark 改变组件大小
- (IBAction)changeSize:(UIButton *)sender {
    
UIView *redBtn=[self.view
viewWithTag:kRedBtnTag];

    [UIView
beginAnimations:nil
context:nil];

    [UIView
setAnimationDuration:.8];

    //缩放开始

     CGAffineTransform  form=redBtn.transform;
    if (sender.tag==9) {
        redBtn.transform=CGAffineTransformScale(form,
1.5, 1.5);
    }else{
        redBtn.transform=CGAffineTransformScale(form,
0.8, 0.8);
    }

    [UIView
commitAnimations];

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  iOS ui 缩放 旋转