当将View的内容作为Material渲染给SCNNode或SCNPlane等时,会报以下警告:
[UIView setAnimationsEnabled:] being called from a background thread. Performing any operation from a background thread
> on UIView or a subclass is not supported and may result in unexpected
> and insidious behavior
比如:将UIButton作为diffuse内容。
let material = SCNMaterial()
material.diffuse.contents = self.myButton
let plane = SCNPlane(width: width, height: height)
plane.materials = [material]
let node = SCNNode(geometry: plane)
node.eulerAngles.x = -.pi / 2
myNode.addChildNode(node)
}
我的解决方案是将button的layer作为渲染的内容:
material.diffuse.contents = self.myButton.layer
参考:
网友评论