【发布时间】:2019-02-02 14:19:35
【问题描述】:
有谁知道我如何在 UITableView 中创建一个 UIButton(约束高度:35,前导:0,尾随:0 和 UITabBar 的底部空间:0),该 UITableView 的底部间距与实现的 UITabBar 的底部间距为零UITableViewController?
到目前为止我尝试了什么:
let btn = UIButton()
btn.setTitle("Test Button text", for: .normal)
btn.tintColor = UIColor.white
btn.backgroundColor = UIColor.darkGray
self.view.addSubview(btn)
btn.translatesAutoresizingMaskIntoConstraints = false
btn.leadingAnchor.constraint(equalTo: self.view.leadingAnchor, constant: 0).isActive = true
btn.bottomAnchor.constraint(equalTo: self.view.bottomAnchor, constant: 0).isActive = true
btn.trailingAnchor.constraint(equalTo: self.view.trailingAnchor, constant: 0).isActive = true
btn.heightAnchor.constraint(equalToConstant: 35).isActive = true
【问题讨论】:
标签: swift uitableview uibutton constraints