转载于:

在使用phonegap3.0的过程中,编译好的APP运行在IOS7系统上默认是与状态栏重叠的,而运行在IOS6及老版本中时是于状态栏分离的,如下图所示,是一个运行在IOS7下的默认状态下的APP

phonegap 如何解决ios7状态栏bar显示问题(转载)

 

可以看出标题已经顶到状态栏了,如果再加上按钮,就不美观了。这时候我们可以用以下办法,使得状态栏和我们的应用分离:

Classes中找到MainViewController.m

phonegap 如何解决ios7状态栏bar显示问题(转载)

 

在其中找到如下代码片段,并修改:

 

 1 - (void)viewWillAppear:(BOOL)animated
 2 {
 3     // View defaults to full size.  If you want to customize the view's size, or its subviews (e.g. webView),
 4     // you can do so here.
 5     if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
 6         CGRect viewBounds = [self.webView bounds];
 7         viewBounds.origin.y = 20;
 8         viewBounds.size.height = viewBounds.size.height - 20;
 9         self.webView.frame = viewBounds;
10     }
11     [super viewWillAppear:animated];
12 }

 

 

这样我们的应用运行起来是这样:

 

phonegap 如何解决ios7状态栏bar显示问题(转载)

 

相关文章: