我正在使用以下代码截图:
// Returns 1024x768 for iPad Retina
CGSize screenDimensions = [[UIScreen mainScreen] 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();
[myView.layer renderInContext:context];
// Save to Camera Roll
UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();
UIImageWriteToSavedPhotosAlbum(screenshot, self, nil, nil);
UIGraphicsEndImageContext();
这是有效的,但是我收到一个用户的报告,称这会导致相机胶卷中的图像不符合 iPad 视网膜分辨率。相反,它看起来更像是 iPad 非视网膜分辨率。 (我没有 iPad 3 来测试这个)。
我还有什么地方做错了吗?
最佳答案
所以我终于拿到了一台实体 iPad Retina,我最初发布的代码运行良好。生成的图像看起来确实具有完整的 Retina 分辨率。
关于ios - 使用 UIGraphicsBeginImageContextWithOptions For iPad 3 (Retina) 的屏幕截图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10703520/