サブビューを持つ UIView のスクリーンショットを生成しようとしていCATransform3DMakeRotation
ます。スクリーンショットが生成されますが、回転が含まれていません。
これを達成することは可能ですか?
実際のビュー:
スクリーンショット画像
次の呼び出しを使用して、ビューを水平に反転します...
currentView.layer.transform = CATransform3DConcat(currentView.layer.transform,CATransform3DMakeRotation(M_PI, 0.0, 1.0, 0.0f));
スクリーンショットを撮るためのコード
+ (UIImage *) imageWithView:(UIView *)view
{
CGSize screenDimensions = view.bounds.size;
// Create a graphics context with the target size
// (last parameter takes scale into account)
UIGraphicsBeginImageContextWithOptions(screenDimensions, NO, 0);
// Render the view to a new context
CGContextRef context = UIGraphicsGetCurrentContext();
[view.layer renderInContext:context];
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}