views:

30

answers:

1

I'm trying to take a full screen image of the camera picture without having the overlay ontop.

In my overlay controller I have tried to hide the overlay with this lines of code:

[self.view setHidden:YES];
[self.view setNeedsDisplay];
CGImageRef screen = UIGetScreenImage();
UIImage* image = [UIImage imageWithCGImage:screen];
CGImageRelease(screen);
self.view.hidden = NO;

UIGetScreenImage still shows the overlay UI.

Is there any way to make this happen?

A: 

You'll need to set the cameraOverlayView property of the UIImagePickerController instance and then use the takePicture method to get the current image. In your delegate, you need to implement:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    [self closeImagePickerController];

    // Get the edited or original image
    UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage];
    if (image == nil)
        image = [info objectForKey:UIImagePickerControllerOriginalImage];

    // Do something with the image...
}

Apple made UIGetScreenImage() a private API again, so you're not allowed to use that anymore.

lucius
This doesn't take a screenshot like `UIGetScreenImage` does. While this will work, the downside is that it's really slow in comparison the the screenshot way (at least in iOS 3 it was).
Rengers
I'm reading everywhere that Apple allows using UIGetScreenImage until they will introduce a public api method?
dan