Reputation: 119
I make a simple application to iPhone with the phonegap library (Phonegap 0.9.6). I like to use the orientation function, but if I rotate the device, the screen don't change.
I tried a few things, but none worked.
I added these lines to _Info.plist
:
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
Next try to add these same lines to the PhoneGap.plist
.
I try to use javascript, but don't work. Anybody know thw solution?
Upvotes: 2
Views: 931
Reputation: 1323
I had the same problem, the only thing that worked for me was to add this code to my js (outside of deviceready):
window.shouldRotateToOrientation = function(degrees) {
return true;
}
Then add to the xml:
<preference name="Orientation" value="default" />
Upvotes: 1
Reputation: 9371
I had the same issue, you need to manually add to the plist file, as far as i can tell it's not copying from the config.xml due to a cordova issue.
So to get full orientation support on all your apple devices make sure the .plist file matches the below:
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
Upvotes: 0
Reputation: 12949
You need to add these to YOUR_APP_NAME-Info.plist :
For iPad :
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
For iPhone :
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
Upvotes: 2