私のアプリでは、画像を保存する必要があります。デバイスが横向きモードであっても、画像を常に縦向きで保存する必要があります。デバイスが横向きモードかどうかを確認しています。横向きモードの場合は、PNG として保存する前に画像を回転させたいと考えています。誰でもこれを理解するのを手伝ってもらえますか?
-(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];
}