【发布时间】:2015-02-23 03:35:22
【问题描述】:
我是移动编程的新手。我正在使用 VideoToolBox 框架在 iOS 应用程序中进行 H264 视频渲染。它具有在渲染视频时拍摄快照的一项功能。每当我拍摄快照时,我只会得到黑屏。 我试过这个 1. 渲染上下文, 2.drawViewHierarchyInRect, 3. snapshotViewAfterScreenUpdates 方法 捕获渲染视频,但仅返回黑屏。
//snapshot coding
UIGraphicsBeginImageContextWithOptions (self.view.bounds.size, YES, 0.0);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *snapshotImage = UIGraphicsGetImageFromCurrentImageContext();
mImageView.image = snapshotImage;
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(snapshotImage,self, @selector(image:didFinishSavingWithError: contextInfo:), nil);
【问题讨论】:
-
以上代码我用来从 IOS 8.1 拍摄快照
标签: ios objective-c xcode snapshot