【发布时间】:2015-11-12 18:07:01
【问题描述】:
我正在使用 youtube cocoapod 库在我的应用中嵌入视频。我正在内联播放它。我需要对应用程序进行一些截图。我使用以下代码截取屏幕截图
UIGraphicsBeginImageContext(self.view.frame.size);
view.layer.renderInContext(UIGraphicsGetCurrentContext())
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
在生成的图像中,运行 youtube 视频的地方是空的。我怎样才能得到视频的截图呢?是不是因为 youtube 视频在 webview 的 iframe 内运行??
【问题讨论】:
-
你也可以在设备上截图
-
不,我想以编程方式截取屏幕截图。该应用程序涉及一些用户操作,需要截取屏幕截图。
-
请尝试使用此代码
self.view.layer.renderInContext(UIGraphicsGetCurrentContext())
标签: ios swift youtube-api