import UIKit
class ViewController: UIViewController ,UITableViewDelegate,UITableViewDataSource{
override func viewDidLoad() {
super.viewDidLoad()
let table = UITableView(frame: UIScreen.main.bounds,style:.grouped)
table.delegate = self
table.dataSource = self
view.addSubview(table)
}
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
var cell = tableView.dequeueReusableCell(withIdentifier: "cell")
if !(cell != nil) {
cell = UITableViewCell(style: .subtitle, reuseIdentifier: "cell")
}
cell?.textLabel?.text = "你家咏哥哥"
return cell!
}
}
swift表格
最新推荐文章于 2022-04-15 15:22:55 发布