Instead of using a private API, why not display the entire UIWindow interface in an image context? This may be enough to replace self.view with self.view.window in your code.
You can also get the current window as an instance property of [UIApplication sharedApplication] . The status bar may be on a separate layer of the window, and you may need to render the windows in order.
Something like that:
UIGraphicsBeginImageContext(self.view.window.frame.size); for (UIWindow *window in [[UIApplication sharedApplication] windows]) { [window.layer renderInContext:UIGraphicsGetCurrentContext()]; } UIImage *screenshotImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);
In any case, you probably don't need to access the private API.
benzado
source share