我正在尝试将UITableView
backgroundView设置为UIView
,在UIView
内我添加了UIButton
,但UIButton
未显示。我做错了什么?
let view: UIView = UIView(frame: CGRect(x: 0, y: 0, width: self.menuTable.bounds.size.width, height: self.menuTable.bounds.size.height))
let loginButton: UIButton = UIButton(frame: CGRect(x: 0, y: 0, width: 200, height: 200))
loginButton.setTitle("Login", for: .normal)
loginButton.backgroundColor = UIColor.white
loginButton.tintColor = UIColor.black
loginButton.addTarget(self, action:#selector(self.pressedConnection), for: .touchUpInside)
view.addSubview(loginButton)
self.menuTable.backgroundView = view
self.menuTable.separatorStyle = .none