I am taking a screenshot of my iPad 3 screen in this way:
UIGraphicsBeginImageContext(self.view.frame.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
int num = arc4random() % 100000000000000;
NSString* path = [documentsDirectory stringByAppendingPathComponent: [NSString stringWithFormat:@"%dtest.png", num]];
NSData* data = UIImagePNGRepresentation(viewImage);
[data writeToFile:path atomically:YES];
The problem is that I have a major loss of quality. I can see the pixels, but its an iPad 3, so how can it be?
more information read a this technical Report : Technical Q&A QA1703 Screen Capture in UIKit Applications
From the doc :
Then :
Your size is wrong, use this: