3

I am implementing AR in my project and in that, I have to show an image on a surface which I am passing as UIView using Nib. It adds the view of image over there on a surface but when I zoom out the view, it shows white layered background which I want to remove.

I have created a function to add a layer which is as below.

func addBox(x: Float = 0, y: Float = 0, z: Float = 0) {

   viewToAdd.backgroundColor = UIColor.clear

   node.geometry?.firstMaterial?.diffuse.contents = viewToAdd

   node.position = SCNVector3(x, y, z)
   sceneView.scene.rootNode.addChildNode(node)
}

In which I have also cleared background color of view and added it but it shows a white background for node.

I also tried with converting viewToAdd.layer as shown in https://stackoverflow.com/a/51607267/6549856, but using this It rotates that Nib View 180d and also stops working all the gestures which I've put.

So how to clear background color of node?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Chintak Patel
  • 748
  • 6
  • 24

0 Answers0