You should have a look a the original Apple Sample “SquareCam”. It shows how to save the image to the camera roll.
]]>if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) {
if ([[UIScreen mainScreen] scale] == 2.0) {
UIGraphicsBeginImageContextWithOptions(self.previewView.bounds.size, YES, 2.0);
} else {
UIGraphicsBeginImageContext(self.previewView.bounds.size);
}
} else {
UIGraphicsBeginImageContext(self.previewView.bounds.size);
}
[self.previewView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(viewImage, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
I just want to save a image of the whole thing that is displaying on the screen, the “live camera” plus the overlay image.
But with this code, I’m getting a completely black image as output.
Can you help me with this? Thank you so much 🙂
]]>