我可以在 config.xml
中将方向设置为仅纵向,如下所示:
<preference name="Orientation" value="portrait"/>
但是我怎样才能允许 iPad 构建横向,同时仍然像上面那样对 iPhone 禁用?
最佳答案
据 Ionic 的 Mike Harrison 说,他说:
Other than manually rotating the device, not really. This would be something you'd writing a plugin for to modify the main App view in cordova
但是有一个 Plugin from Ionic 1 .看它。最终您也可以在 Ionic 2 中使用它。
有了这个插件,你可以做这样的事情:
if(/(ipad)/i.test(navigator.userAgent)) {
//THIS IS THE PLUGIN IONIC 1 CODE
$scope.changeOriantationPortrait = function() {
screen.lockOrientation('portrait');
}
}
关于cordova - Ionic 2 - 仅为 iPad 启用横向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43179396/