screenshot, 960*640, but with 44pix transparent status-bar on the top of the picture.
How to capture a picture with 916pix height? I do not need that blank bar on the top.
Here is my code:
-(void)takeScreenShot{
UIWindow *window = [UIApplication sharedApplication].keyWindow;
CGSize imageSize = [[UIScreen mainScreen] bounds].size;
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]){
UIGraphicsBeginImageContextWithOptions(imageSize, NO, 0.0f);
}else{
UIGraphicsBeginImageContext(imageSize);
}
[window.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSData * data = UIImagePNGRepresentation(image);
//
NSString *documentsDirectory= [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
NSString *filePath= [documentsDirectory stringByAppendingPathComponent:@"SYS_screen_shot@2x.png"];
//
[data writeToFile:filePath atomically:YES];
}