When doing a rotation, I'm getting an out of place view/scene. The viewWillTransition method is as below:
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator)
{
let newRect = CGRect(x: 0, y: 0, width: size.width, height: size.height)
let newSize = CGSize(width: size.width, height: size.height)
self.view.frame = newRect
let skView = self.view as! SKView
if let sceneNode = skView.scene as! GameScene? {
sceneNode.size = newSize
sceneNode.position = CGPoint(x: self.view.frame.midX, y: self.view.frame.midY)
}
}
Can someone please let me know what I'm doing wrong?
Thank you
Try this,