转换后的图像不能保存

时间:2015-06-06 22:21:39

标签: ios objective-c uiimageview transformation uislider

嘿我正在尝试使用两个UISliders来旋转和缩放UIImageView但是当我从一个滑块更改为另一个滑块时,它会将UIImageView重置为默认图像,而不是缩放/旋转的图像。缩放滑块的代码:

- (IBAction)scaleImage:(UISlider *)sender {
    UIImageView *selectedImage = [_myArray objectAtIndex:0];
    CGAffineTransform transform = CGAffineTransformScale(CGAffineTransformIdentity, sender.value, sender.value);
    selectedImage = transform;
    [_myArray removeObjectAtIndex:0];
    [_myArray insertObject:selectedImage atIndex:0];
}

和旋转滑块的代码:

- (IBAction)rotateImage:(UISlider *)sender {
    UIImageView *selectedImage = [_myArray objectAtIndex:0];
    selectedImage.transform = CGAffineTransformMakeRotation(sender.value * 2*M_PI / sender.maximumValue);
    [_myArray removeObjectAtIndex:0];
    [_myArray insertObject:selectedImage atIndex:0];
}

我尝试使用removeObjectAtIndex:0然后将UIImageView读回到下一行中的数组,尝试“保存”转换后的图像,但无济于事。有没有人知道如何在切换滑块后停止图像重置为默认图像?

0 个答案:

没有答案