SCNView transparent background not working on iPhone5 and iPhone5C

Setting the background of SCNView to UIColor.clearColor() is not working on iPhone5 and iPhone5C. It only displays white background color.

I have tried it running on iPhone5S and iPhone6plus and it's working fine.


let sceneview = SCNView()

sceneview.frame = self.view.bounds

sceneview.background = UIColor.clearColor()

Try setting the scene's background. This generates a transparent image on iOS 10 on an iPad:


let view = SCNView(frame: CGRect(origin: .zero, size: size))
let scene = SCNScene()
scene.background.contents = UIColor.clear
scene.rootNode.addChildNode(someModelNode)
view.scene = scene
return view.snapshot()

thanks imtzo, this actually solved my problem.


Setting SCNView's backgroundColor property seems only working on my old iPad mini (iOS 9.3.5) but not my iPhone 7 or other simulators (iOS 11). The default behavior for which background to display (between the SCNScene's background property and the enclosing SCNView's backgroundColor property).


According to the latest documentation, it seems the default behavior is to display the SCNScene's background above the SCNView's backgroundColor property:


"If the material property’s contents object is

nil
, SceneKit does not draw any background before drawing the rest of the scene. (If the scene is presented in an SCNView instance, the view’s background color is visible behind the contents of the scene.)"
SCNView transparent background not working on iPhone5 and iPhone5C
 
 
Q