美文网首页
iOS-混合开发去掉状态栏高度

iOS-混合开发去掉状态栏高度

作者: 鱼与熊掌不能兼得 | 来源:发表于2018-11-29 08:42 被阅读7次

第一步:在pist文件添加 View controller-based status bar appearance 字段并设为YES

第二步:在controller中添加如下代码

  • (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.
    if([[[UIDevice currentDevice] systemVersion] floatValue] >= 7){
    CGRect viewBounds = [self.webView bounds];
    viewBounds.origin.y = -20;
    viewBounds.size.height = viewBounds.size.height;
    self.webView.frame = viewBounds;
    }

    [super viewWillAppear:animated];

这样就完美的去掉的状态栏的高度

相关文章

网友评论

      本文标题:iOS-混合开发去掉状态栏高度

      本文链接:https://www.haomeiwen.com/subject/bjcxcqtx.html