为了账号安全,请及时绑定邮箱和手机立即绑定

带Phonegap的iOS 7状态栏

带Phonegap的iOS 7状态栏

iOS
MYYA 2019-12-09 15:59:44
在iOS 7中,Phonegap应用程序将出现在状态栏下方。这可能导致难以单击位于屏幕顶部的按钮/菜单。是否有人知道在Phonegap应用程序中解决iOS 7上此状态栏问题的方法?我试图用CSS抵消整个网页,但似乎无法正常工作。有没有办法喜欢偏移整个UIWebView或只是使状态栏的行为像在iOS6中一样?
查看完整描述

3 回答

?
开满天机

TA贡献1786条经验 获得超13个赞

我在另一个线程上找到了答案,但是如果有人怀疑,我会回答这个问题。


只需将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];

}


查看完整回答
反对 回复 2019-12-09
?
狐的传说

TA贡献1804条经验 获得超3个赞

除了路德维希·克里斯托弗森(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;

}


查看完整回答
反对 回复 2019-12-09
  • 3 回答
  • 0 关注
  • 546 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信