phonegap中的屏幕方向问题

时间:2015-05-15 12:05:50

标签: ios cordova screen-orientation

我一直在使用phonegap构建。 最近我遇到了只在手机上以纵向模式运行我的应用程序的需要,而且只在平板电脑上运行我的应用程序(相同的应用程序 - 不同的方向),从配置文件我看到没有这样的区别可用。 PG是否有能力这样做?它是否可用于PGB。 这有解决方案吗? 谢谢 通过使用下面的代码我修复了问题

 var deviceType = (navigator.userAgent.match(/iPad/i))  == "iPad" ? "iPad" : (navigator.userAgent.match(/iPhone/i))  == "iPhone" ? "iPhone" : (navigator.userAgent.match(/Android/i)) == "Android" ? "Android" : (navigator.userAgent.match(/BlackBerry/i)) == "BlackBerry" ? "BlackBerry" : "null";
    if(deviceType=='iPad')
    {
    screen.lockOrientation('landscape');
    }
    if(deviceType=='iPhone')
    {
    screen.lockOrientation('portrait');
    }

0 个答案:

没有答案