How to lock screen orientation to portrait or landscape?
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:
<gap:config-file platform="ios" parent="UISupportedInterfaceOrientations" overwrite="true"> <array> <string>UIInterfaceOrientationPortraitOmg</string> </array> </gap:config-file>
1<gap:config-file platform="ios" parent="UISupportedInterfaceOrientations" overwrite="true">
2 <array>
3 <string>UIInterfaceOrientationPortraitOmg</string>
4 </array>
5</gap:config-file>
For Landscape:
<gap:config-file platform="ios" parent="UISupportedInterfaceOrientations" overwrite="true"> <array> <string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeRight</string> </array> </gap:config-file>
1<gap:config-file platform="ios" parent="UISupportedInterfaceOrientations" overwrite="true">
2 <array>
3 <string>UIInterfaceOrientationLandscapeLeft</string>
4 <string>UIInterfaceOrientationLandscapeRight</string>
5 </array>
6</gap:config-file>
Source: https://github.com/phonegap/build/issues/263