I took screenshot of overlay image with background camera controller. But background cameracontroller layer is hiding when taking picture
code:
CGRect rect = [previewView bounds];
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[previewView.layer renderInContext:context];
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(img, nil, nil, nil);
The camera preview layer is not a common CALayer and is not taken into account with render in context. Render in context works only with a kind of CALayer. The most effettive way is get a screenshot directly from the camera buffer.