在UIImagePickerController中获取相机预览的图像表示

问题描述:

当我使用标准 [view.layer renderInContext:UIGraphicsGetCurrentContext()]; 方法将视图转换为iPhone相机模态视图中的图像时,我得到的只是黑色控件,相机预览的位置。

When I use the standard [view.layer renderInContext:UIGraphicsGetCurrentContext()]; method for turning views into images on the iPhone camera modal view, all I get is the controls with black where the camera preview was.

任何人都有解决方案吗?速度不是问题。

Anyone have a solution for this? Speed is not an issue.

不可能来自记录的api,但可能。在相机的子视图中找到PLCameraView视图,然后调用

Not possible from a documented api, but possible. Find the "PLCameraView" view in the camera's subviews, then call

CGImageRef img = (CGImageRef)[foundCameraView imageRef];

这将返回对相机所持图像的引用。

This will return a reference to the image that camera holds.