我已经阅读了很多与此相关的答案,但仍无法使其正常工作。
我有一个视图,用户可以在其中签名。它看起来像这样:http://d.pr/i/McuE
我可以成功地检索此图像并将其保存到文件系统中,但在保存之前需要将其旋转90度,以便签名从左到右读取。
// Grab the image
UIGraphicsBeginImageContext(self.signArea.bounds.size);
[self.signArea drawRect: self.signArea.bounds];
UIImage *signatureImage = UIGraphicsGetImageFromCurrentImageContext();
//-- ? -- Rotate the image (this doesn't work) -- ? --
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextRotateCTM(context, M_PI_2);
UIGraphicsEndImageContext();
//Save the image as a PNG in Documents folder
[UIImagePNGRepresentation(signatureImage) writeToFile:[[PPHelpers documentsPath] stringByAppendingPathComponent:@"signature-temp.png"] atomically:YES];
如何在保存之前旋转图片?
感谢您的帮助。 我使用iOS 7 SDK上的Xcode 5。
CGContextRef context = UIGraphicsGetCurrentContext(); CGContextRotateCTM(context, M_PI_2);
- Clifton Labrum