Larisa Larisa - 1 year ago 46
Swift Question

How to get the proper dimensions of the scene

I noticed the dimensions of the screen are wrong. I am in portrait mode and if I print the width and the height of my scene, they are 1024x768. How do I get proper dimensions? I did find some articles about that in Objective-C and tried to figure out how to do it in Swift but have no idea how because I am a beginner in Swift and programming.

Is there any straightforward approach to solving this?


Use self.view.bounds to get the size of the screen (assuming your view is fullscreen)

The view shows a portion of your scene. You can move the view around the scene to scroll your game. Therefore the scene dimensions are different than the screen dimensions.