このコードを使用して、スクリーンショットをキャプチャし、フォトアルバムに保存しています。
-(void)TakeScreenshotAndSaveToPhotoAlbum
{
UIWindow *window = [UIApplication sharedApplication].keyWindow;
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
UIGraphicsBeginImageContextWithOptions(window.bounds.size, NO, [UIScreen mainScreen].scale);
else
UIGraphicsBeginImageContext(window.bounds.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
}
しかし、問題は、スクリーンショットが保存されるたびに、iPhoneのステータスバーがキャプチャされないことです。代わりに、下部に空白が表示されます。次の画像のように:
私は何が間違っているのですか?