[AR开发]报警告:将View加到SceneView中出现的线程

2019-05-02  本文已影响0人  沈枫_ShenF

当将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

参考:

UIView Animated being called from a background thread

上一篇 下一篇

猜你喜欢

热点阅读