ios - specifying scene's background color in SceneKit -


i'm trying specify background color (which black) of screen before scene appears. searched documentation , found:

var background: scnmaterialproperty { }

a background rendered before rest of scene. (read-only) if material property’s contents object nil, scenekit not draw background before drawing rest of scene. (if scene presented in scnview instance, view’s background color visible behind contents of scene.)

so went , sent contents color.

scene.background.contents = uicolor.redcolor() 

however, moment before scene renders, screen(scnview portion of it) still black. doing wrong? perhaps background property not need? i'm not quite sure if can drill further down property get(bacground getter), , set stuff did in code example. answering

try setting backgroundcolor property of scnview instance. in code, have following: (some of code may not apply situation, should give general idea.)

if let scene = scnscene(named: "myscene.scn") {         ...   // retrieve scnview   let scnview = self.view as! scnview    // set scene view   scnview.scene = scene    // configure view   scnview.backgroundcolor = uicolor.redcolor() } 

some of generated apple's template scenekit game. last line important one. should mention i'm using xcode 7 beta swift 2, in case there subtle differences.

edit: seems misinterpreted question bit. change background color of view before scene loaded, click on main.storyboard, , in interface builder, click view property inside view controller. set background color property in inspector tab.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -