宽窄优行-由【嘉易行】项目成品而来
younger_times
2023-07-05 0d8f5fc8a516bfd07e425909e4a4432600572ee7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//
//  MineExpenseRecordCell.swift
//  OKProject
//
//  Created by alvin_y on 2020/6/16.
//  Copyright © 2020 yangwang. All rights reserved.
//
 
import UIKit
 
class MineExpenseRecordCell: UITableViewCell {
    
    /// 金额
    private var label_money: UILabel = {
       let label = UILabel()
        label.textColor = UIColor.color(light: UIColor.color(hexString: "#000000"), dark: UIColor.color(hexString: "#000000"))
        label.font = Medium(font: 14)
        return label
    }()
    
    /// 日期
    private var label_date: UILabel = {
       let label = UILabel()
        label.textColor = UIColor.color(light: UIColor.color(hexString: "#000000",0.4), dark: UIColor.color(hexString: "#000000",0.4))
        label.font = Medium(font: 12)
        return label
    }()
    
    /// 类型
    private var label_type: UILabel = {
       let label = UILabel()
        label.textColor = ThemeColor
        label.font = UIFont.systemFont(ofSize: 12)
        return label
    }()
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        setupViews()
        defineLayouts()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
        
    }
 
    
    func configure(model: ExpenseRecordModel){
        label_money.text = "¥\(model.money.remain2Digits())"
        label_date.text = model.time
        label_type.text = model.name
    }
    
    func setupViews()  {
        contentView.addSubview(label_money)
        contentView.addSubview(label_date)
        contentView.addSubview(label_type)
    }
    
    //MARK: - Layouts
    func defineLayouts() {
        label_money.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(15)
            make.left.equalToSuperview().offset(14)
        }
        label_date.snp.makeConstraints { (make) in
            make.top.equalTo(label_money.snp.bottom)
            make.left.equalToSuperview().offset(14)
            make.bottom.equalToSuperview().offset(-8)
        }
        label_type.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.right.equalToSuperview().offset(-14)
        }
    }
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
 
        // Configure the view for the selected state
    }
 
}