// // TotalTaskViewController.swift // Meterage // // Created by 203 on 2023/2/3. // import UIKit class TotalTaskViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { @IBOutlet weak var tableView: UITableView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. tableView.register(UINib(nibName: "TotalTaskTableViewCell", bundle: nil), forCellReuseIdentifier: "totalTaskTableViewCell") tableView.dataSource = self tableView.delegate = self tableView.separatorColor = .hintColor tableView.tableFooterView = UIView(frame: CGRect.zero) } func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 60 } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { TOTAL_TASK_TITLE_ARRAY.count } private let TOTAL_TASK_TITLE_ARRAY = ["万用表 S82828828", "万用表 S82828828", "万用表 S82828828", "万用表 S82828828", "万用表 S82828828", "万用表 S82828828", "万用表 S82828828", "万用表 S82828828", "万用表 S82828828", "万用表 S82828828"] private let TOTAL_TASK_DATE_ARRAY = ["有效期 2021-11-11", "有效期 2021-11-11", "有效期 2021-11-11", "有效期 2021-11-11", "有效期 2021-11-11", "有效期 2021-11-11", "有效期 2021-11-11", "有效期 2021-11-11", "有效期 2021-11-11", "有效期 2021-11-11"] func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell: TotalTaskTableViewCell = tableView.dequeueReusableCell(withIdentifier: "totalTaskTableViewCell", for: indexPath) as! TotalTaskTableViewCell cell.cellTitleView.text = TOTAL_TASK_TITLE_ARRAY[indexPath.row] cell.cellDateView.text = TOTAL_TASK_DATE_ARRAY[indexPath.row] //设置分割线上下左右边距 cell.separatorInset = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 0) cell.selectionStyle = .none return cell } func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) { } }