I am using the following code to take a screenshot of one of my view controller, and then show it later in another view. For the UIGraphicsBeginImageContextWithOptions method, if feed it 1.0 as scale, the result image would looked blurry; but if give it 0.0 as scale, the result image would be big than the screen and would can see partial of it when show in another view. Is there a way to fix this?
CGSize imageSize = [[UIScreen mainScreen] bounds].size;
if (NULL != UIGraphicsBeginImageContextWithOptions) {
UIGraphicsBeginImageContextWithOptions(imageSize, NO, 1.0);
} else {
UIGraphicsBeginImageContext(imageSize);
}
[_displayViewController.view.layer renderInContext:UIGraphicsGetCurrentContext()];
// Retrieve the screenshot image
UIImage *screenImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();