PhoneGap Hello World change orientation

2019-05-10 13:04发布

This is silly, but if I run phonegap create someApp, and then edit the config.xml file from:

<preference name="orientation" value="default" />

to

<preference name="orientation" value="landscape" />

and run on ios, nothing changes. In fact, its locked in portrait mode. Whats up with this? This is a fresh app, no modifications. Documentation says that this is all there is to it, but it does nothing. Not finding any help anywhere else online... Thanks in advance.

1条回答
男人必须洒脱
2楼-- · 2019-05-10 13:41

Check this http://plugins.cordova.io/#/package/net.yoik.cordova.plugins.screenorientation for possible solution.

I have updated the js/index.js file from the default app:

onDeviceReady: function() {
    app.receivedEvent('deviceready');
    screen.lockOrientation('landscape'); //this is the new line
},

This is just a workaround as now the app works differently on Android and iOS :(

查看更多
登录 后发表回答