我正在使用ARKit开展AR项目.
我想在ARKit场景中添加一个UIView.当我点击一个对象时,我希望将信息作为对象旁边的"弹出窗口".这些信息在UIView中.
是否可以将此UIView添加到ARKit场景?我将这个UIView设置为场景,然后我该怎么办?我可以给它一个节点然后将它添加到ARKit场景吗?如果是这样,它是如何工作的?
或者还有另一种方式吗?
谢谢!
编辑:我的SecondViewController的代码
class InformationViewController: UIViewController {
@IBOutlet weak var secondView: UIView!
override func viewDidLoad() {
super.viewDidLoad()
self.view = secondView
}
}
Run Code Online (Sandbox Code Playgroud)
编辑2:firstViewController中的代码
guard let secondViewController = storyboard?.instantiateViewController(withIdentifier: "SecondViewController") as? SecondViewController else {
print ("No secondController")
return
}
let plane = SCNPlane(width: CGFloat(0.1), height: CGFloat(0.1))
plane.firstMaterial?.diffuse.contents = secondViewController.view
let node = SCNNode(geometry: plane)
Run Code Online (Sandbox Code Playgroud)
我只得到一架飞机的白色屏幕,而不是视线.