CNLiveHangYeFirCell.swift 1.83 KB
//
//  CNLiveHangYeFirCell.swift
//  metaCode
//
//  Created by zx on 2024/7/23.
//

import Foundation
import SnapKit

class CNLiveHangYeFirCell:UITableViewCell{
    
    var _authModel : MineAuthenticationsChildModel?
    var authModel : MineAuthenticationsChildModel? {
        get{
            _authModel
        }
        set{
            _authModel = newValue!
            setupNewUI(model: _authModel!)
        }
    }
    
    var _isSelect = false
    var isSelect:Bool{
        get{
            _isSelect
        }
        set{
            _isSelect = newValue
            if _isSelect == true{
                self.nameLabel.textColor = HexColor("#1961FE")
                self.nameLabel.backgroundColor = .white
            }else{
                self.nameLabel.textColor = HexColor("#999999")
                self.nameLabel.backgroundColor = HexColor("#F6F7FB")
            }
        }
    }
    lazy var nameLabel: UILabel = {
        let titleLabel = UILabel()
        titleLabel.textColor = HexColor("#1961FE")
        titleLabel.text = "名称名称"
        titleLabel.font = BoldFont_14
        titleLabel.textAlignment = .center
        titleLabel.adjustsFontSizeToFitWidth = true
        return titleLabel
    }()
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.selectionStyle = .none
        self.initUI()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func initUI(){
        self.contentView.addSubview(self.nameLabel)
        self.nameLabel.snp.makeConstraints { make in
            make.top.bottom.left.right.equalToSuperview()
        }
    }
    
    func setupNewUI(model:MineAuthenticationsChildModel){
        self.nameLabel.text = model.name
    }
}