I have an iPad app for iOS which I would like to work in both portrait and landscape mode but I have narrowed the issue down to being a problem specifically with landscape mode.
In the settings in xcode I have the device orientation set as follows (I realise these are connected to the orientation setting in config.xml but its quicker to debug directly in xcode):
So the problem is that if I launch the device in landscape mode, the app seems to be in the wrong orientation and also cut off like so:
If I rotate the device to portrait and then back to landscape, it corrects itself but obviously this is undesirable.
Some info about my setup:
- Latest Ionic 1.2.0
- Ionic CLI 1.7.11
- Cordova ios 3.9.2
- Cordova CLI 5.4.1
- I’m on a mac (osX 10.10.3) running xcode 6.4
- Testing app on an iPad Mini (ios 8.1.2) but problem is also happening on an ipad air running ios 8.3
- My viewport meta tag looks like
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">but I have tried with a few variations and even no meta tag but it has no effect.
I have tried lots of different variations of
<preference name="Orientation" value="landscape" /> and
<preference name="Orientation" value="default" /> and
<preference name="Orientation" value="all" /> in the config.xml.
The best solution I have got at the moment (Which @Gajotres suggested here) is to omit the
<preference name="Orientation" /> tag completely and use the cordova screenorientation plugin to unlock the orientation. BUT there is one problem with this…
Now when I launch the device in landscape mode, although it fixes the weird cut-off effect. The app still seems to think it’s in portrait mode (i.e. same as previous screenshot, just without the black border and the buttons are further along to edge of the screen). I have to rotate the device to portrait and then back to landscape mode and it then corrects itself. Again not desirable.
I have been wrestling with this for quite a while now and don’t know where to go with this issue. I find it a bit strange that there is such a glaring problem with a supposedly trivial task of launching an ipad app in landscape mode which makes me think that I must be doing something wrong but it seems quite a few other people are having the same issue so I don’t know what to think.
Is anyone able to help solve this?