[Phonegap+Sencha Touch] 移动开发20 IOS7状态栏问题

来源:互联网 发布:皂基洗面奶知乎 编辑:程序博客网 时间:2024/06/06 03:33

在使用phonegap3.0的过程中,编译好的APP运行在IOS7系统上默认是与状态栏重叠的,而运行在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 7if ([[[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];}
0 0