捕获 UIImagePickerController 的预览

发布于 2024-08-13 06:33:35 字数 352 浏览 5 评论 0原文

这个问题已经被问过很多次了。但大多数答案不适用于最新的操作系统(3.0+)或者“苹果将拒绝它”。

我需要的是以编程方式抓取 UIImagePickerController 预览中显示的图像,而无需用户拍照并使用该图像 - 我实际需要的是获取我的应用程序的屏幕截图,其中包含背景中的相机和其他前景上的东西。

我尝试了几种方法,最新的方法是:迭代 UIImagePickerController.view 的所有子视图,并使用 [view.layer renderInContext:] 方法将它们保存为图像。通过这种方法,我实际上可以获得控制器的所有资源(按钮等),但我永远看不到实际的预览。有没有人想办法在 3.0+ 中做到这一点?

This has been asked many times. But most answers are not applicable to the latest OS (3.0+) or they are "Apple will reject it".

What I need is to programmatically grab the image displayed in the preview of the UIImagePickerController without having the user take a photo and use the image - what I actually need is to get a screenshot of my app, which contains the camera in the background and other stuff on the foreground.

I have tried several methods, with the latest being: iterate through all the subviews of the UIImagePickerController.view and save them as images using the [view.layer renderInContext:] method. With this method, I can actually get all the controller's assets (the buttons etc) but I can never see the actual preview. Has anyone figured a way to do this in 3.0+ ?

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

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

发布评论

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

评论(1

从此见与不见 2024-08-20 06:33:35

问题 1317978 已经回答了这个问题。另外,请查看描述数独解算器中的实时抓取

This has been answered in question 1317978 already. Also, have a look at the blog post describing live grabbing in sudoku solver

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