views:

810

answers:

2

Hi, with fw 2.2 i was able to get a screenshot using the private method _createCGImageRefRepresentationInFrame of UIWindow. In 3.0 doesn't exist anymore.

I used that method with the PLCameraView over a window to take a small video just by get as much screenshot as possible. Now i tried with the CALayer of the PLPreviewView and -renderInContext: method, but it always render the view as it has the iris closed.

How can i take a screenshot of what the cameraView is showing?

Thanks Marco

+1  A: 

Hey Dude

Try for following code snippet to get

CGImageRef imageRef = [[UIApplication sharedApplication] createDefaultImageSnapshot]; UIImage img = [UIImage imageWithCGImage:imageRef];

//Now you can save it the way you want //May as following //oops yes this image is just the screenshot so better take care of unwanted image side //So cut crap out from the image captured UIImageWriteToSavedPhotosAlbum(img, nil, nil, nil);

Well while working on Video Recording on iPhone 3.0, i am facing problem for saving the sequences of images, Please help me out

Waiting.........

Thanks Jayant . New Delhi, INDIA

A: 

I've tried createDefaultImageSnapshot just yesterday without success. I'll try it once again. I tried also the createSnapshotWithRect: method of UIView but the camera view on the snapshot is always black.

Speaking about saving screenshots,check this thread:

http://stackoverflow.com/questions/332120/iphone-video-buffer

Marco

Marco
Ok, now it works. Many thanks!!!
Marco