更新时间:2023-11-08 12:31:52
使用PGB,我们现在可以添加到info.plist文件。所以在你的config.xml中这样:
< gap:config-file platform =iosparent =UISupportedInterfaceOrientations overwrite =true>
< array>
< string> UIInterfaceOrientationPortrait< / string>
< / array>
< / gap:config-file>阅读更多,在这里看到这个确切的例子:
http://phonegap.com/ blog / 2014/01/30 / customizing-your-android-manifest-and-ios-property-list-on-phonegap-build /
I have a PhoneGap 3.1 application that I build remotely on PhoneGap Build.
In my app there is a single config.xml
file at the root of the project. This file contains:
<preference name="orientation" value="default" />
However I would like to restrict the orientation to portrait mode in iOS.
I've randomly tried :
<preference gap:platform="ios" name="orientation" value="portrait" />
and
<gap:platform name="ios">
<preference name="orientation" value="portrait" />
</gap:platform>
but none of these seem to work.
How can I set preferences for specific platforms?
With PGB we now have the ability to add to the info.plist file. So in your config.xml put this:
<gap:config-file platform="ios" parent="UISupportedInterfaceOrientations" overwrite="true">
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
</gap:config-file>
Read more and see this exact example here:
http://phonegap.com/blog/2014/01/30/customizing-your-android-manifest-and-ios-property-list-on-phonegap-build/