ios - How to set the scalemode of a scene when I transit into it? -


my problem when trying switch scene, view of different when start scene.

the problem -i think- scale mode, tried set scale mode didn't work. have tried:

let skview = self.view! skview  let gamescene:gamescene = gamescene(size: self.frame.size) gamescene.size = skview.bounds.size gamescene.scalemode = skscenescalemode.resizefill  skview.presentscene(gamescene , transition: sktransition.crossfadewithduration(1)) 

and this:

let gamescene = gamescene(size: self.size)  gamescene.scalemode = skscenescalemode.resizefill  self.view?.scene!.presentscene(gamescene , transition: sktransition.crossfadewithduration(1)) 

and have tried set scale mode of scene in didmovetoview() function.

none of these methods helps, help?

here's example transition 1 scene another. supposed gamemenu first scene , want transition gamescene.

in gameviewcontroller initialize gamemenu size:

override func viewdidload() {     super.viewdidload()      let scene = gamemenu(size: view.bounds.size)     // configure view.     let skview = self.view as! skview     skview.showsfps = true     skview.showsnodecount = true      /* sprite kit applies additional optimizations improve rendering performance */     skview.ignoressiblingorder = true      /* set scale mode scale fit window */     scene.scalemode = .aspectfill      skview.presentscene(scene) } 

now, should @ first scene. when transition gamescene, add following code needed:

let nextscene = gamescene(size: self.size) scene?.view?.presentscene(nextscene, transition: sktransition.crossfadewithduration(1)) 

and everything's done , gamescene appears. check sample project if have problem.


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -