宽窄优行-由【嘉易行】项目成品而来
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
//
//  MineTripRedEnvelopeCell.swift
//  OKProject
//
//  Created by alvin_y on 2020/6/16.
//  Copyright © 2020 yangwang. All rights reserved.
//
 
import UIKit
 
class MineTripRedEnvelopeCell: UITableViewCell {
 
    private let image_cover: UIImageView = {
       let imageView = UIImageView()
        imageView.image = UIImage.init(named: "hongbao")
        return imageView
    }()
    
    /// 金额
    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_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")
    }
    
    
    func configure(model: SwitchCityModel){
        label_money.text = "¥\(model.amount)"
        label_type.text = model.name
    }
    
    func setupViews()  {
        contentView.addSubview(image_cover)
        contentView.addSubview(label_money)
        contentView.addSubview(label_type)
    }
    
    //MARK: - Layouts
    func defineLayouts() {
        image_cover.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.left.equalToSuperview().offset(14)
            make.size.equalTo(CGSize(width: 26, height: 26))
        }
        label_money.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.left.equalTo(image_cover.snp.right).offset(6)
        }
        label_type.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.right.equalToSuperview().offset(-14)
        }
    }
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }
 
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
 
        // Configure the view for the selected state
    }
 
}