Set the Supported Device Orientation

Apple Game Frameworks and Technologies — by Tammy Coron (23 / 193)

The Pragmatic Programmers
The Pragmatic Programmers

--

👈 Clean Up the Default Templ ate | TOC | Create Your First SpriteKi t Scene 👉

The default iOS Game template is set to work in both portrait and landscape orientation. However, Gloop Drop is designed for landscape only, so you need to restrict the device orientation.

In the Project Navigator, select the gloopdrop project and look at the Deployment Info section in the Project Editor. You need to set a few options in this section.

First, verify that the iPhone and iPad devices are both enabled. Gloop Drop is also designed to work universally, so you need to let the compiler know to target both.

Next, disable the Portrait option and enable Requires full screen as shown in the following image:

images/CreatingScenesWithSpritesAndNodes/spritekit-deployment-info.png

You might think that disabling the Portrait option in this section is enough to force landscape orientation on all devices, but it’s not. To fix this problem, you need to temporarily disable the iPhone option while you set up the iPad options separately, like so:

--

--

The Pragmatic Programmers
The Pragmatic Programmers

We create timely, practical books and learning resources on classic and cutting-edge topics to help you practice your craft and accelerate your career.