CNLiveMineSubBodyListView.swift
2.92 KB
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
89
90
91
92
93
94
//
// CNLiveMineSubBodyListView.swift
// metaCode
//
// Created by open on 2023/6/7.
//
import Foundation
class MineInfoLListTableViewCell : UITableViewCell {
lazy var mainView: UIImageView = {
let mainView = UIImageView.init()
mainView.contentMode = .scaleToFill
mainView.backgroundColor = .clear
mainView.isUserInteractionEnabled = true
mainView.image = UIImage(named: "mine_sub_list_add_info")
return mainView
}()
lazy var iconView : UIImageView = {
let iconView = UIImageView.init()
iconView.contentMode = .scaleToFill
iconView.backgroundColor = .clear
iconView.layer.masksToBounds = true
iconView.layer.cornerRadius = 25
return iconView
}()
lazy var titleLabel: UILabel = {
let titleLabel = UILabel.init()
titleLabel.backgroundColor = .clear
titleLabel.textColor = .black
titleLabel.font = BoldFont_18_Fit
return titleLabel
}()
lazy var addBtn: UIButton = {
let addBtn = UIButton.init(type: .custom)
addBtn.setTitle(" 去添加 ", for: .normal)
addBtn.setTitleColor(.white, for: .normal)
addBtn.backgroundColor = HexColor("#67C5FF")
addBtn.titleLabel?.font = BoldFont_15
addBtn.layer.cornerRadius = 15
addBtn.layer.masksToBounds = true
return addBtn
}()
public func setupWithDataSource(icon: String, name: String) {
iconView.image = UIImage(named: icon)
titleLabel.text = name
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.selectionStyle = .none
self.backgroundColor = .clear
addSubview(mainView)
mainView.addSubview(iconView)
mainView.addSubview(titleLabel)
mainView.addSubview(addBtn)
setupConstraints()
}
func setupConstraints() {
mainView.snp.makeConstraints { make in
make.left.equalToSuperview().offset(15)
make.right.equalToSuperview().offset(-15)
make.top.equalToSuperview().offset(5)
make.bottom.equalToSuperview().offset(-5)
}
iconView.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.left.equalToSuperview().offset(15)
make.size.equalTo(50)
}
titleLabel.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.left.equalTo(iconView.snp.right).offset(10)
}
addBtn.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.right.equalToSuperview().offset(-15)
make.width.equalTo(80)
make.height.equalTo(30)
}
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}