Skip to content

How to lock screen orientation to portrait or landscape?

Ayyaz Zafar1 min read

This article will show you how to lock screen orientation to one direction.
Environment Details:
– Phonegap Build – cli-5.2.0
– Device: iPhone S5 9.3.2

For locking orientation to portrait add following code into your config.xml:

Text
<gap:config-file platform="ios" parent="UISupportedInterfaceOrientations" overwrite="true">    <array>        <string>UIInterfaceOrientationPortraitOmg</string>    </array></gap:config-file>

For Landscape:

Text
<gap:config-file platform="ios" parent="UISupportedInterfaceOrientations" overwrite="true">   <array>       <string>UIInterfaceOrientationLandscapeLeft</string>       <string>UIInterfaceOrientationLandscapeRight</string>   </array></gap:config-file>

Source: https://github.com/phonegap/build/issues/263

Latest tutorials

All 754 →

Get new tutorials by email

One email when something new is published. Unsubscribe anytime.

Written by Ayyaz Zafar, full-stack developer for 15+ years. Work with me