http://stackoverflow.com/questions/1194752/how-can-i-flip-a-uiimageview
#import <QuartzCore/QuartzCore.h>
...
- (UIImage *) flipImageVertically:(UIImage *)originalImage direction:(NSString *)axis {
UIImageView *tempImageView = [[UIImageView alloc] initWithImage:originalImage];
UIGraphicsBeginImageContext(tempImageView.frame.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGAffineTransform flipVertical = CGAffineTransformMake(0, 0, 0, 0, 0, 0);
if([axis isEqualToString:@"x"])
{
flipVertical = CGAffineTransformMake(
1, 0, 0, -1, 0, tempImageView.frame.size.height
);
}
else if([axis isEqualToString:@"y"] )
{
flipVertical = CGAffineTransformMake(
-1, 0, 0, 1, tempImageView.frame.size.width, 0
);
}
CGContextConcatCTM(context, flipVertical);
[tempImageView.layer renderInContext:context];
UIImage *flipedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[tempImageView release];
return flipedImage;
}
//
imageView 是一个UIImageView的实例//左右flip
//上下flip
imageView.transform = CGAffineTransformMakeScale(1.0,-1.0);