My previous answer was wrong. I have been working on this and I have an answer to the right screenshot. This will save the right right screen shot in the camera roll. I have not tried the landscape.
This is a variant of the answer presented in another question here . The problem with this answer is that there is always an image on the screen. Orientation (read-only) of UIImageOrientationUp. Therefore, we must know what the orientation was and change it accordingly.
Hope this helps. If it works on the landscape on the left or you get a variation that works on the left edge, please post it.
- (IBAction)cameraButtonClick:(id)sender { UIWindow *screenWindow = [[UIApplication sharedApplication] keyWindow]; UIGraphicsBeginImageContext(screenWindow.frame.size); [screenWindow.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext(); UIImageWriteToSavedPhotosAlbum([self scaleAndRotateImage:screenshot], nil, nil, nil); UIGraphicsEndImageContext(); }
source share