親愛なる学者 私は次のコードを使用して画面をキャプチャし、フォト アルバム内の jpg に保存しています。これはうまく機能します。
それでも、高解像度の iPhone 4 で実行すると、高解像度とは対照的に、キャプチャされた画面は 320X480 しかありません (これは iPad でも同様であると思います)。
この問題はどうすればいいですか?
// Save the captured image to photo album
- (IBAction)saveAsJPG
{
UIImage *image = [self captureView:self.view];
UIImageWriteToSavedPhotosAlbum(image, self,
@selector(image:didFinishSavingWithError:contextInfo:), nil);
}
-(UIImage *)captureView:(UIView *)view
{
CGRect screenRect = [[UIScreen mainScreen] bounds];
UIGraphicsBeginImageContext(screenRect.size);
CGContextRef ctx = UIGraphicsGetCurrentContext();
[[UIColor blackColor] set];
CGContextFillRect(ctx, screenRect);
[view.layer renderInContext:ctx];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}