Phonegap page has wrong rotation, shows as portrait in landscape mode

cordova, html, ipad, screen-orientation

Solution

You can check the root Controller - shouldAutorotateToInterfaceOrientation, allow rotation for certain orientation. Hope it helps.

For example `return true` in `Classes/MainViewController.m`:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    //return (interfaceOrientation == UIInterfaceOrientationPortrait);
    return true;
}

Problem

I have a (simple) web page packed in a phonegap app. If I start the app it shows the page in portrait direction with landscape page width. So the text starts left bottom to left top. On the right I have a gap where the page should end. This is what I see: Supported orientations are landscape left and right in my `...-Info.plist`: ``` <key>UISupportedInterfaceOrientations</key> <array> <string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeRight</string> </array> <key>UISupportedInterfaceOrientations~ipad</key> <array> <string>UIInterfaceOrientationLandscapeRight</string> <string>UIInterfaceOrientationLandscapeLeft</string> </array> ``` On my iPad I locked the screen rotate. The launch image shows up correct in landscape. The page is designed to fit into landscape with fixed sizes. This is my viewport: ``` <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" /> ``` and the page has the correct width for landscape but it is turned around. I can scroll up and down. The ipad status bar jumps from the top to the left after app start. UPDATE I change target device to iPad only and allowed orientation to Landscape Left only now the status bar is on the top where it needs to be. Page is still turned... I also tried to make a simple page version that should rotate what did not work either. Update 2 In `Classes/MainViewController.m` I have: ``` - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation == UIInterfaceOrientationPortrait); } ```

Original source

Related problems