views:

59

answers:

1

How can i take screenshot from code ?

+2  A: 

http://www.iphonedevsdk.com/forum/iphone-sdk-development/2353-possible-make-screenshot-programmatically-2.html

#include <QuartzCore/QuartzCore.h>

UIGraphicsBeginImageContext(Background.bounds.size);
[Background.window.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);
kovpas