Newer
Older
Meterage_iOS / Meterage / ViewControllers / Sample / UnderTaskViewController.swift
//
//  UnderTaskViewController.swift
//  Meterage
//
//  Created by 203 on 2023/2/3.
//

import UIKit

class UnderTaskViewController: 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: "UnderTaskTableViewCell", bundle: nil), forCellReuseIdentifier: "underTaskTableViewCell")
        tableView.dataSource = self
        tableView.delegate = self
        tableView.separatorColor = .hintColor
        tableView.tableFooterView = UIView(frame: CGRect.zero)
    }

    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        80
    }

    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {

    }

    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        UNDER_TASK_TITLE_ARRAY.count
    }

    private let UNDER_TASK_TITLE_ARRAY = ["万用表 S82828828", "万用表 S82828828", "万用表 S82828828", "万用表 S82828828", "万用表 S82828828", "万用表 S82828828", "万用表 S82828828"]
    private let UNDER_TASK_POSITION_ARRAY = ["AAAA实验室", "AAAA实验室", "AAAA实验室", "AAAA实验室", "AAAA实验室", "AAAA实验室", "AAAA实验室"]
    private let UNDER_TASK_PERSON_ARRAY = ["王小波", "王小波", "王小波", "王小波", "王小波", "王小波", "王小波"]

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell: UnderTaskTableViewCell = tableView.dequeueReusableCell(withIdentifier: "underTaskTableViewCell", for: indexPath) as! UnderTaskTableViewCell
        cell.taskTitleView.text = UNDER_TASK_TITLE_ARRAY[indexPath.row]
//        cell.taskQrCodeView.text =
        cell.taskPositionView.text = UNDER_TASK_POSITION_ARRAY[indexPath.row] + "---" + UNDER_TASK_PERSON_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) {

    }
}