我一直在使用 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!
发布评论
评论(2)
这与你的略有不同。
那有用吗?
如果没有,您可能想尝试在 iphonedevsdk.com 上询问,因为他们专注于 iPhone 的所有产品。
This is slightly different than yours.
Does that work?
If not, you might want to try asking over at iphonedevsdk.com since they specialize in all things iPhone.
让他们拍张照片。然后将您的图像覆盖在其上面。
从 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