Some times you have to capture a portion of you iPhone application programmatically; The quickest way is to pass the target view to following method and get its screenshot as an UIImage; [sourcecode language="objc"] -(UIImage*)captureFullScreen:(UIView*) targetView{ UIGraphicsBeginImageContext(targetView.view.frame.size); [self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *fullScreenshot = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); UIImageWriteToSavedPhotosAlbum(fullScreenshot, nil, nil, nil); return fullScreenshot; } [/sourcecode]

- To capture the whole screen, you don't need to pass any parameter to this method; instead, use self.view.frame in the first line.

- To save the captured image into your device's album, use  the following.

[sourcecode language="objc"]

 UIImageWriteToSavedPhotosAlbum(fullScreenshot, nil, nil, nil);

[/sourcecode]

HAPPY DEVELOPMENT;

free counters