我有一个简单的 ARKit 应用(SceneKit)。我创建一个 SCNBox,然后在多维数据集的正面添加一个 Web 视图。
func createBox(position: SCNVector3) {
let box = SCNBox(width: 0.1, height: 0.1, length: 0.1, chamferRadius: 1)
guard let url = URL(string: "https://www.google.com") else { return }
let request = URLRequest(url: url)
let webView = WKWebView(frame: CGRect(x: 0, y: 0, width: 500, height: 500), configuration: WKWebViewConfiguration())
webView.load(request)
let sides = [
webView, // Front
UIColor.black, // Right
UIColor.black, // Back
UIColor.black, // Left
UIColor.black, // Top
UIColor.black // Bottom
]
let materials = sides.map { (side) -> SCNMaterial in
let material = SCNMaterial()
material.diffuse.contents = side
material.locksAmbientWithDiffuse = true
return material
}
box.materials = materials
let boxNode = SCNNode(geometry: box)
boxNode.position = position
sceneView.scene.rootNode.addChildNode(boxNode)
}
它仅显示白屏。这不是空白页。我可以滚动并点按某个地方。如果我打开一个红色背景的网站,它将是红色,依此类推。它可以工作,但是我只能看到背景(也许还有一个元素.例如在https://apple.com上,我看到背景和顶部的灰线(navigation))。我该如何解决?谢谢。