PhoneGap iOS app loads in Landscape mode in differ

2019-08-31 02:29发布

问题:

I am using Cordova 2.9 in ios application which supports iPad also.

For IOS application everything is fine. But in my iPad application the view frame shows portrait mode in ViewDidAppear which means instead of giving Landscape frame, the view is giving portrait frame but the Status bar orientation is in Landscape mode.

I added only portrait orientation in info.plist file for Supported interface orientations property. and added both landscape modes to Supported interface orientations(IPad) property.

And added below code in my baseViewControllers

-(BOOL)shouldAutorotate {
         return NO;
}

-(NSUInteger)supportedInterfaceOrientations {
     if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
            return UIInterfaceOrientationPortrait;
     } else {
            return UIInterfaceOrientationLandscapeLeft;
     }
}
- (NSUInteger)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window
{
     if (UI_USER_INTERFACE_IDIOM == UIUserInterfaceIdiomPad)
     {
         return UIInterfaceOrientationMaskLandscape;
     }
     else
     {
         return UIInterfaceOrientationMaskPortrait;
     }
}

All the views of the entire application (both hybrid pages and Native pages) is showing as per attached picture's orientation only.

https://dl.dropboxusercontent.com/u/65087860/Screen%20Shot%202014-01-14%20at%207.51.17%20PM.png

https://dl.dropboxusercontent.com/u/65087860/Screen%20Shot%202014-01-14%20at%207.54.27%20PM.png

In ViewDidAppear, I am getting Orientation is Landscape Left and self.view.frame size is {768, 1024}

I am using xcode 5 and iOS7 Mac 10.8.5

Could someone help me in this Issue.