在iOS 7中,Phonegap应用程序将出现在状态栏下方.这会使点击屏幕顶部的按钮/菜单变得困难.
有没有人知道在iOS 7的Phonegap应用程序中解决这个状态栏问题的方法?
我试图用CSS来偏移整个网页,但似乎不起作用. 有没有一种方法可以像偏移整个UIWebView一样,或者只是让状态栏像iOS6中那样运行?
谢谢
在iOS 7中,Phonegap应用程序将出现在状态栏下方.这会使点击屏幕顶部的按钮/菜单变得困难.
有没有人知道在iOS 7的Phonegap应用程序中解决这个状态栏问题的方法?
我试图用CSS来偏移整个网页,但似乎不起作用. 有没有一种方法可以像偏移整个UIWebView一样,或者只是让状态栏像iOS6中那样运行?
谢谢
我在另一个帖子上找到了答案,但我会回答这个问题,以防其他人想知道.
只需将MainViewController.m
中的viewWillAppear
替换为:
- (void)viewWillAppear:(BOOL)animated {
// View defaults to full size. If you want to customize the view's size, or its subviews (e.g. webView),
// you can do so here.
// Lower screen 20px on ios 7
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
CGRect viewBounds = [self.webView bounds];
viewBounds.origin.y = 20;
viewBounds.size.height = viewBounds.size.height - 20;
self.webView.frame = viewBounds;
}
[super viewWillAppear:animated];
}