gpt4 book ai didi

ios - 使用 UIGraphicsBeginImageContextWithOptions For iPad 3 (Retina) 的屏幕截图

转载 作者:可可西里 更新时间:2023-11-01 05:57:23 25 4
gpt4 key购买 nike

我正在使用以下代码截图:

    // 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com