2
在我的应用程序中,我需要保存图像。即使设备处于横向模式,我也需要将图像始终保存为肖像。我正在检查设备是否处于横向模式,如果是,我想在将图像保存为PNG之前旋转图像。任何人都可以帮我解决这个问题吗?在保存iOS之前旋转图像
-(void) saveImage {
UIGraphicsBeginImageContext(self.view.bounds.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
if (UIInterfaceOrientationIsLandscape([[UIDevice currentDevice] orientation])) {
//// need to rotate it here
}
NSData *data = UIImagePNGRepresentation (viewImage);
[data writeToFile:savePath atomically:YES];
}
你有没有想过这个?我在这里问基本相同的问题:http://stackoverflow.com/questions/20764623/rotate-newly-created-ios-image-90-degrees-prior-to-saving-as-png ...我' d爱任何你可以提供的帮助。 :) –