代码之家  ›  专栏  ›  技术社区  ›  Erik

显示表格状态栏下的视图

  •  3
  • Erik  · 技术社区  · 9 年前

    我想展示我的 UITableView 应用程序启动时状态栏下的内容(现在可以通过滚动来实现)。

    这是我目前的结果:

    enter image description here

    但我希望它看起来像这样:

    enter image description here

    我已经为 UINavigationController

    enter image description here

    我已经试着调整了这样的插入 viewDidLoad :

    [self.tableView setContentInset:UIEdgeInsetsMake(0, 0, 0, 0)];
    

    但是,它并没有按要求显示。

    3 回复  |  直到 9 年前
        1
  •  4
  •   Vizllx    9 年前

    在此方法中添加代码- -viewDidLayoutSubview()

    [self.tableView setContentInset:UIEdgeInsetsMake(0, 0, 0, 0)];
    
        2
  •  3
  •   Alaa Eddine Cherbib    4 年前

    设置tableView contentInsetAdjustmentBehavior属性

    tableView.contentInsetAdjustmentBehavior = .never

        3
  •  0
  •   SivolcC    6 年前

    这就是我的工作。

    tableView.contentInset = UIEdgeInsets(top: -UIApplication.shared.statusBarFrame.size.height, left: 0, bottom: 0, right: 0)