iPhone 截图

发布于 2024-09-11 07:03:45 字数 656 浏览 3 评论 0原文

我一直在使用 UIGetScreenImage() 来获取 UIImagePickerController 的屏幕截图。基本上我使用相机覆盖层,然后当我拍摄屏幕截图时,我会看到相机预览显示的图像以及我的覆盖层,这正是我所需要的。

现在 UIGetScreenImage() 已被禁止,我还没有找到方法来做到这一点。它只为相机显示黑色。

编辑:我的所有其他视图都显示得非常好,只是不是实际的相机预览。有什么想法吗??!?!?

这是我目前正在使用的代码。


UIGraphicsBeginImageContext(picker.view.bounds.size);
[picker.view.layer renderInContext:UIGraphicsGetCurrentContext()];
CGContextDrawImage(context, bounds, camView.CGImage);
UIImage* screenImage = UIGraphicsGetImageFromCurrentImageContext();
UIImageWriteToSavedPhotosAlbum(screenImage, nil, nil, nil); 
UIGraphicsEndImageContext();

有什么想法如何获得叠加层+相机图像吗?

谢谢!

I've been using UIGetScreenImage() to get a screenshot of a UIImagePickerController. Basically I use the camera overlay and then when I take the screenshot, I have the image that the camera preview had been showing and my overlay on there too, which is exactly what I need.

Now UIGetScreenImage() has been banned, I've not been able to find a way to do this. It just shows black for the camera.

Edit: all of my other views are showing absolutely fine, just not the actual camera preview. Any ideas??!?!?

Here's the code I am using at the moment.


UIGraphicsBeginImageContext(picker.view.bounds.size);
[picker.view.layer renderInContext:UIGraphicsGetCurrentContext()];
CGContextDrawImage(context, bounds, camView.CGImage);
UIImage* screenImage = UIGraphicsGetImageFromCurrentImageContext();
UIImageWriteToSavedPhotosAlbum(screenImage, nil, nil, nil); 
UIGraphicsEndImageContext();

Any ideas how I can get the overlay + the camera image?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

丢了幸福的猪 2024-09-18 07:03:45

这与你的略有不同。

CGRect screenRect = [[UIScreen mainScreen] bounds];
        UIGraphicsBeginImageContext(screenRect.size);
        [self.layer renderInContext:UIGraphicsGetCurrentContext()];
        UIImage *sShot = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
        UIImageWriteToSavedPhotosAlbum (sShot, nil, nil, nil);

那有用吗?

如果没有,您可能想尝试在 iphonedevsdk.com 上询问,因为他们专注于 iPhone 的所有产品。

This is slightly different than yours.

CGRect screenRect = [[UIScreen mainScreen] bounds];
        UIGraphicsBeginImageContext(screenRect.size);
        [self.layer renderInContext:UIGraphicsGetCurrentContext()];
        UIImage *sShot = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
        UIImageWriteToSavedPhotosAlbum (sShot, nil, nil, nil);

Does that work?

If not, you might want to try asking over at iphonedevsdk.com since they specialize in all things iPhone.

最近可好 2024-09-18 07:03:45

让他们拍张照片。然后将您的图像覆盖在其上面。

从 iPhone 上的另外两个 UIImage 创建一个 UIImage

Have them take a picture. Then overlay your image on top of it.

Create a UIImage from two other UIImages on the iPhone

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文