我有一个视图,里面有 4 个 uiimage,其中 1 个是静态的,但另外 3 个可以移动、更改大小和水平翻转,我可以随意移动图像,但问题是当我想更改大小或翻转一张图像,我之前所做的所有更改都恢复正常。这是我使用滑块更改大小的代码
- (IBAction)sizePhoto:(UISlider *)sender {
switch (cambiaSize) {
case 1:
[_imagen1 setTransform:CGAffineTransformMakeScale(sender.value, sender.value)];
break;
case 2:
[_imagen2 setTransform:CGAffineTransformMakeScale(sender.value, sender.value)];
break;
case 3:
[_imagen3 setTransform:CGAffineTransformMakeScale(sender.value, sender.value)];
break;
}
}
这就是我翻转图像的方式
- (IBAction)flipPhonto:(id)sender {
switch (cambiaSize) {
case 1:
if (boton1flip == true) {
_imagen1.transform = CGAffineTransformScale(_photo.transform,1.0, 1.0);
boton1flip = false;
}else{
_imagen1.transform = CGAffineTransformScale(_photo.transform,-1.0, 1.0);
boton1flip = true;
}
break;
case 2:
if (boton2flip == true) {
_imagen2.transform = CGAffineTransformScale(_photo.transform,1.0, 1.0);
boton2flip = false;
}else{
_imagen2.transform = CGAffineTransformScale(_photo.transform,-1.0, 1.0);
boton2flip = true;
}
break;
case 3:
if (boton3flip == true) {
_imagen3.transform = CGAffineTransformScale(_photo.transform,1.0, 1.0);
boton3flip = false;
}else{
_imagen3.transform = CGAffineTransformScale(_photo.transform,-1.0, 1.0);
boton3flip = true;
}
break;
}}
我不知道我做错了什么,当我改变大小时如何保持以前的所有更改?