ios - iPhone X UITableViewController 带有固定底栏显示不透明工具栏下方的表格内容
问题描述
我想制作一个带有固定底栏的 UITableViewController。所以我用这些代码做了这个。
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
saveButton.size = CGSize(width: self.view.width, height: 50)
saveButton.translatesAutoresizingMaskIntoConstraints = false
saveButton.addTarget(self, action: #selector(saveContactsInfo), for: .touchUpInside)
self.navigationController?.setToolbarHidden(false, animated: animated)
let btn = UIBarButtonItem(title: "", style: .plain, target: self, action: #selector(saveContactsInfo))
let fixspace = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil)
fixspace.width = CGFloat.leastNormalMagnitude
self.navigationController?.toolbar.items = [fixspace, btn, fixspace]
self.navigationController?.toolbar.addSubview(saveButton)
self.navigationController?.toolbar.leadingAnchor.constraint(equalTo: saveButton.leadingAnchor).isActive = true
self.navigationController?.toolbar.trailingAnchor.constraint(equalTo: saveButton.trailingAnchor).isActive = true
self.navigationController?.toolbar.topAnchor.constraint(equalTo: saveButton.topAnchor).isActive = true
self.navigationController?.toolbar.bottomAnchor.constraint(equalTo: saveButton.bottomAnchor).isActive = true
self.navigationController?.toolbar.clipsToBounds = true
self.navigationController?.toolbar.barTintColor = UIColor.white
self.navigationController?.toolbar.setBackgroundImage(UIImage(color: UIColor.white), forToolbarPosition: .bottom, barMetrics: .default)
}
底部栏显示如我所愿,但表格视图显示在底部栏下方。像这样:
我尝试取消选中 Under Bottom Bars,但效果不佳。
我只希望底部栏下方的区域是白色的。如何使这个显示正确?
解决方案
推荐阅读
- javascript - 在 django 中使用 python 函数调用 javascript 函数
- java - 如何使用android中的动画将苹果放入篮子中?
- javascript - keystone.js 中的链式关系
- javascript - 字段验证器错误 Jquery
- xpath - XPATH - 在命名元素之后抓取 div 的内容
- html - 可以显示网页cookies的HTML按钮
- c# - 复合键、EF6 和插入顺序
- sql-server - 如何检查嵌套存储过程是否在 tsqlt 中执行
- reactjs - Keycloak json 配置文件,React 和 Router 4
- node.js - 环回验证在更新查询中不起作用?