正如你正在做的那样,你正在翻转UIImageView
它的X-Axis
not UIImage
。所以很明显代码会保存你的原始图像。
翻转你的UIImage
而不是UIImageView
然后保存 -
UIImage *flippedImage = [UIImage imageWithCGImage:sourceImage.CGImage scale:1.0 orientation: UIImageOrientationUpMirrored];
现在使用您的保存方法 -
UIImageWriteToSavedPhotosAlbum(flippedImage, nil, nil, nil);
编辑:
-(void)tapFlipXPosition:(id)sender
{
UIImage* sourceImage = yourSourceImage;
UIImage* flippedImage;
if(sourceImage.imageOrientation == UIImageOrientationUpMirrored)
{
flippedImage = [UIImage imageWithCGImage:sourceImage.CGImage scale:1.0 orientation: UIImageOrientationUp];
}
else
{
flippedImage = [UIImage imageWithCGImage:sourceImage.CGImage scale:1.0 orientation: UIImageOrientationUpMirrored];
}
UIImageWriteToSavedPhotosAlbum(flippedImage, nil, nil, nil);
}