标签:
1.图片设置(平移,缩放,旋转)
创建一个transform属性
//按钮点击时,只能执行一次向上旋转 //派 M_PI_4 45度旋转 1. CGAffineTransform transforms= CGAffineTransformMakeRotation(M_PI_4); //按钮点击时,可多次执行缩放 //self.image.transfrom 获取原始位置 image是图片定义的属性名称 2. CGAffineTransform transforms = CGAffineTransformRotate(self.image.transform, M_PI_4); //按钮点击时,可多次执行向上平移 //self.view.transfrom 获取原始位置 //y轴 0 保持不动 //x轴 -50 向上平移 3.CGAffineTransform transforms = CGAffineTransformMakeTranslate(0, -50); //按钮点击时,可多次执行平移 4.CGAffineTransform transforms = CGAffineTransformTranslate(self.image.transform, 0, -50); //按钮点击时,只能执行一次向上缩放 //放大1.5倍 如:0.5就是缩小 5.CGAffineTransform transforms= CGAffineTransformMakeScale(1.5, 1.5); //按钮点击时,可多次执行缩放 6. CGAffineTransform transforms = CGAffineTransformScale(self.image.transform, 0.5, 0.5); //赋值给按钮 7.self.image.transform =transforms; //还原最初 8.self.image.transform =CGAffineTransformIdentity; // 动画执行代码 9.[UIView animateWithDuration:3 animations:^{ self.image.transform = CGAffineTransformTranslate(self.image.transform, 0, -50); self.image.transform = CGAffineTransformScale(self.image.transform, 0.5, 0.5); slef.image.transform = CGAffineTransformRotate(self.image.transform, M_PI_4); }];
标签:
原文地址:http://www.cnblogs.com/zzgt/p/4796158.html