【发布时间】:2017-09-02 14:18:26
【问题描述】:
有人在 ARKit 项目中截取了ARSKView 的屏幕截图吗?
我尝试过这样的事情:
if let sc = view.snapshotView(afterScreenUpdates: true) {
DispatchQueue.main.async {
UIGraphicsBeginImageContextWithOptions(sc.bounds.size, true, 0.0)
sc.drawHierarchy(in: sc.bounds, afterScreenUpdates: true)
let screenshot = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
UIImageWriteToSavedPhotosAlbum(screenshot!, nil, nil, nil)
}
}
但输出的是黑色图像。
在 Apple 的示例中,他们使用 ARSCNView,他们可以在其中调用快照函数,它会自动完成所有操作。
我使用的是 SpriteKit 而不是 SceneKit,所以在 spriteKit 中没有快照方法。
【问题讨论】:
标签: ios sprite-kit augmented-reality arkit