UITableViewController重叠底部安全区域

时间:2019-01-30 16:40:14

标签: swift uitableview iphone-x safearealayoutguide

我在情节提要中添加了一个Tableview Controller,问题是它与iPhone X的底部安全区域重叠。我在底部的一个视图也位于safeAreaLayoutGuide上方。我尝试使用自动布局并将其锚定到 view.safeAreaLayoutGuide.bottomAnchor ,但这是行不通的。任何帮助,将不胜感激。这是我尝试过的方法,没有其他选择,但没有帮助。

override func viewWillLayoutSubviews() {
    super.viewWillLayoutSubviews()
    tableView.translatesAutoresizingMaskIntoConstraints = false
    tableView.topAnchor.constraint(equalTo:view.safeAreaLayoutGuide.topAnchor).isActive = true
    tableView.leadingAnchor.constraint(equalTo:view.safeAreaLayoutGuide.leadingAnchor).isActive = true
    tableView.trailingAnchor.constraint(equalTo:view.safeAreaLayoutGuide.trailingAnchor).isActive = true
    tableView.bottomAnchor.constraint(equalTo:view.safeAreaLayoutGuide.bottomAnchor).isActive = true  }

enter image description here

0 个答案:

没有答案
相关问题