我的 PhoneGap 应用程序在 iOS 7 上搞砸了,显然大多数人一开始都是这样 - 状态栏很清晰,文本位于(重叠)我的应用程序基于 HTML 的导航栏的顶部。我通过以下方式解决了这个问题:
在 [应用名称] info.plist 中:
View controller-based status bar : NO
Status bar style : UIStatusBarStyleLightContent
在 MainViewController.m 下面- (void)viewWillAppear:(BOOL)animated
是:
self.view.frame = [[UIScreen mainScreen] applicationFrame];
[super viewWillAppear:animated];
NSArray *vComp = [[UIDevice currentDevice].systemVersion
componentsSeparatedByString:@"."];
if ([[vComp objectAtIndex:0] intValue] >= 7) { // iOS 7 or above
CGRect oldBounds = [self.view bounds];
/* Changing the -20 to 0 takes away the black bar
at the top, making the status bar text overlap
my content again... positive 20 of course makes
my content cut off by 20px at the top, so obviously
this is the cause of the problem */
CGRect newBounds = CGRectOffset(oldBounds, 0, -20);
[self.view setBounds:newBounds];
}
我不会费心拍摄 MainViewController.xib 文件的设置窗格的图像,因为我很确定它们与我在 info.plist 中设置的内容无关?让我知道我是否错了。
我的应用程序也支持旋转,以防万一。我正在使用 Cordova 2.1.0。
问题
由于我在尝试使 iOS 7 的状态栏正确显示时添加的内容,我的 HTML 代码在底部被截断了 20 像素。如果我在应用程序的页面底部并且我拖动手指以进一步向下滚动,我实际上可以看到我的页面底部,但是当我抬起手指时它仍然被截断 20 像素(如果这是没有意义的)。这里有什么问题?我该如何解决?在 iOS 6 及更低版本中,这不是问题 - 一切都很完美。
谢谢!