PhoneGap Hello World更改方向 [英] PhoneGap Hello World change orientation

查看:141
本文介绍了PhoneGap Hello World更改方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是愚蠢的,但如果我运行phonegap创建someApp,然后编辑config.xml文件从:

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

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

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

并在ios上运行,没有任何更改。其实,它锁定在纵向模式。这是什么?这是一个新的应用程序,没有修改。文档说,这是所有有它,但它什么也没有。

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.

推荐答案

检查此 http://plugins.cordova.io/#/package/net.yoik.cordova.plugins.screenorientation 可能的解决方案。

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

我更新了默认应用程序中的js / index.js文件:

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
},

这只是一个解决方法,现在应用在Android和iOS上的工作方式不同:

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

这篇关于PhoneGap Hello World更改方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆