uitableview使用方法
`
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
let ta:UITableView = UITableView(frame: UIScreen.main.bounds, style: .plain)
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
ta.delegate = self
ta.dataSource = self
self.view.addSubview(ta)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return arrVedioName.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell:UITableViewCell = UITableViewCell()
cell.textLabel?.text = arrVedioName[indexPath.row]
let btn:UIButton = UIButton(type: .contactAdd)
btn.setTitle("hiok", for: .normal)
btn.frame = CGRect(x: 0, y: 0, width: 200, height: 50)
cell.addSubview(btn)
return cell
}
}
`