本文介绍了iOS 7状态栏与Phonegap的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在iOS 7中,Phonegap应用程序将显示在状态栏下方。这可能会导致难以点击已放置在屏幕顶部的按钮/菜单。

In iOS 7, Phonegap applications will appear underneath the status bar. This can make it difficult to click on buttons/menus that have been placed at the top of the screen.

是否有人知道如何解决此状态栏问题在iOS 7在Phonegap应用程序?

Is there someone who knows a way to fix this status bar issue on iOS 7 in a Phonegap application?

我试图用CSS来抵消整个网页,但似乎不工作。
有没有办法偏移整个UIWebView或只是使状态栏的行为像它在iOS6?

I've tried to offset the entire web page with CSS but it doesn't seem to work.Is there a way to like offset the entire UIWebView or just make the status bar behave like it did in iOS6?

感谢

推荐答案

我在另一个线程中找到了答案,但我会回答这个问题,以防其他人想知道。

I found an answer on another thread, but I'll answer the question in case someone else wonders.

只需替换 MainViewController.m 中的 viewWillAppear this:

Just replace the viewWillAppear in MainViewController.m with this:

- (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];
}

这篇关于iOS 7状态栏与Phonegap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 08:20