//实现一张图片左右的翻转
(UIImage ) doUnrotateImage: (UIImage ) image
{
CGSize size = image.size;
UIGraphicsBeginImageContext(size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGAffineTransform transform = CGAffineTransformMakeScale(-1.0f, 1.0f);
size = CGSizeMake(size.height, size.width);
CGContextConcatCTM(context, transform);CGRect rect=CGRectMake(0.0f, 0.0f,image.size.width, image.size.height);
UIGraphicsBeginImageContext(rect.size);//根据size大小创建一个基于位图的图形上下文
CGContextRef currentContext = UIGraphicsGetCurrentContext();//获取当前quartz 2d绘图环境
CGContextClipToRect(currentContext, rect);//设置当前绘图环境到矩形框CGContextRotateCTM(currentContext, M_PI);
CGContextTranslateCTM(currentContext, -rect.size.width, -rect.size.height);
CGContextDrawImage(currentContext, rect, image.CGImage);//绘图
UIImage *newimg = UIGraphicsGetImageFromCurrentImageContext();//获得图片
UIGraphicsEndImageContext();//从当前堆栈中删除quartz 2d绘图环境
return newimg;
}