我在支持iPad的ios应用程序中使用Cordova 2.9。
对于IOS应用程序,一切都很好。但在我的iPad应用程序中,视图框架在ViewDidAppear中显示纵向模式,这意味着视图不是给出横向框架,而是提供纵向框架,但状态栏方向处于横向模式。
我在info.plist文件中仅为支持的界面方向属性添加了纵向方向。并将两种横向模式添加到支持的界面方向(IPad)属性。
并在我的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;
}
}
整个应用程序的所有视图(混合页面和本机页面)仅按附加图片的方向显示。
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
在ViewDidAppear中,我得到的方向是左侧横向,而self.view.frame大小为{768,1024}
我使用的是xcode 5和iOS7 Mac 10.8.5
有人可以在这个问题上帮助我。