0

我用背景相机控制器截取了叠加图像。但是拍照时后台cameracontroller层隐藏了

代码:

CGRect rect = [previewView bounds];
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[previewView.layer renderInContext:context];   
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
 UIImageWriteToSavedPhotosAlbum(img, nil, nil, nil);
4

1 回答 1

1

相机预览层不是常见的 CALayer,在上下文中渲染时​​不考虑在内。在上下文中渲染仅适用于一种 CALayer。最有效的方法是直接从相机缓冲区获取屏幕截图。

于 2013-03-27T05:20:44.463 回答