有人知道我如何在UITableView中创建UIButton(约束高度:35,前导:0,尾部:0,UITabBar的底部空间:0,底部空间为UITabBar:0),该UITableView的底部间距为UITabBar,在UITableView中实现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
答案 0 :(得分:0)
继承Uitabbar并将其分配给您的标签栏。然后在类中添加您的按钮代码。不要忘记取消选中选项卡的cliptobound属性。