猿问

带Phonegap的iOS 7状态栏

在iOS 7中,Phonegap应用程序将出现在状态栏下方。这可能导致难以单击位于屏幕顶部的按钮/菜单。

是否有人知道在Phonegap应用程序中解决iOS 7上此状态栏问题的方法?

我试图用CSS抵消整个网页,但似乎无法正常工作。有没有办法喜欢偏移整个UIWebView或只是使状态栏的行为像在iOS6中一样?


MYYA
浏览 547回答 3
3回答

开满天机

我在另一个线程上找到了答案,但是如果有人怀疑,我会回答这个问题。只需将viewWillAppearin 替换为MainViewController.m:- (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];}

狐的传说

除了路德维希·克里斯托弗森(Ludwig Kristoffersson)的尺寸调整功能外,我建议更改状态栏颜色:- (void)viewDidLoad{    [super viewDidLoad];    // Do any additional setup after loading the view from its nib.    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;    }    self.view.backgroundColor = [UIColor blackColor];}-(UIStatusBarStyle)preferredStatusBarStyle{    return UIStatusBarStyleLightContent;}
随时随地看视频慕课网APP

相关分类

iOS
我要回答