Johnston
Johnston

Reputation: 20884

SpriteKit SKScene size.width says 1024 docs say it should be 768

I set the app to be in portrait only. When I println(self.size.width) on the initial SKScene it gives me 1024. Documentation say "So, a scene is initialized with a height of 1024 and a width of 768..." here: https://developer.apple.com/library/ios/documentation/GraphicsAnimation/Conceptual/SpriteKit_PG/Nodes/Nodes.html.

Why is my width 1024?

Is the width based on the rotation of the phone at all or is it always the same?

Upvotes: 2

Views: 2062

Answers (1)

Mick MacCallum
Mick MacCallum

Reputation: 130193

Yes, the width can be based on the device's orientation, but if you're only supporting portrait mode I don't think this is your problem. If you're creating your scene through Xcode's scene designer, you're seeing the height and width that were defined within that scene. To change this, open "YourScene.sks" and navigate through the following to change the scene's dimensions to something more appropriate:

Utilities -> SKNode Inspector -> Change Width and Height

enter image description here

Upvotes: 4

Related Questions