【发布时间】:2019-10-24 14:13:54
【问题描述】:
我是 Scenekit 开发的初学者,我正在尝试将 UIView 添加为 SCNPlane 节点的漫反射内容,但遇到了一些奇怪的崩溃。
代码:
override func viewDidLoad() {
super.viewDidLoad()
let scene = SCNScene()
let plane = SCNPlane(width: 0.1, height: 0.1)
plane.firstMaterial?.diffuse.contents = getCustomView()
let planeNode = SCNNode(geometry: plane)
planeNode.position = SCNVector3(0, 0, 0)
scene.rootNode.addChildNode(planeNode)
sceneView.scene = scene
}
func getCustomView() -> UIView {
let view = UIView()
view.backgroundColor = .red
return view
}
崩溃:
我正在尝试通过设计 UIView 来实现以下输出
请告诉我如何将 UIView 添加为 SCNNode 的漫反射内容。
【问题讨论】:
-
各位,好运吗?
标签: ios swift sprite-kit uikit scenekit