I have a universal app and want only portrait orientation for iPhone and landscape for iPad. I don't believe I can just do,
<preference name="Orientation" value="landscape" />
because I can't see how it would differentiate between phone and tablet. Currently I've got this in the root:
...
<platform name="ios">
<config-file target="foo-Info.plist" platform="ios" parent="UISupportedInterfaceOrientations">
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
</config-file>
<config-file target="foo-Info.plist" platform="ios" parent="UISupportedInterfaceOrientations~ipad">
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</config-file>
...
</platform>
...
cordova build ios
and I have tried cordova prepare
commands, neither update the plist file. cordova build ios
? You don't have to hardcode your app name here:
<config-file platform="ios" target="*-Info.plist" parent="UISupportedInterfaceOrientations">
To get it working create hooks/after_prepare/011_update_platform_config.js
file, take content from here.
Install some npms:
npm install lodash elementtree plist
ionic run
, ionic build
and ionic prepare
commands should update your project files.
For more information check out this topic
P.S.: Your should have a strong reason to use upside-down orientation on an iPhone otherwise it's a pain for users (hello to iBooks).