PhoneGap iOS app loads in Landscape mode in different orientation

夙愿已清 提交于 2019-12-13 05:09:33

问题


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.

来源:https://stackoverflow.com/questions/21038653/phonegap-ios-app-loads-in-landscape-mode-in-different-orientation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!