gpt4 book ai didi

iphone - MPMoviePlayerController 拍摄屏幕截图但仅显示黑屏

转载 作者:行者123 更新时间:2023-12-03 19:44:00 28 4
gpt4 key购买 nike

我在播放MPMoviePlayerController时截屏。完美保存屏幕截图,但图像只有黑色。我使用下面的代码。

UIGraphicsBeginImageContext(self.moviePlayerController.view.frame.size);
[self.moviePlayerController.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);

最佳答案

终于我解决了这个问题...我正在使用这段代码...完美工作...感谢所有人...

- (void)captureScreenShot
{
CGImageRef originalImage = UIGetScreenImage();
CGImageRef videoImage = CGImageCreateWithImageInRect(originalImage, CGRectMake(0, 66, 320, 230));
UIImage *snapShotImage = [UIImage imageWithCGImage:videoImage];
UIImageWriteToSavedPhotosAlbum(snapShotImage, nil, nil, nil);
CGImageRelease(originalImage);
CGImageRelease(videoImage);
}

关于iphone - MPMoviePlayerController 拍摄屏幕截图但仅显示黑屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11258765/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com