CNLiveMineBodyListView.swift
5.86 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
//
// CNLiveMineBodyListView.swift
// metaCode
//
// Created by open on 2023/6/7.
//
import Foundation
class MineBodyOneListViewCell : UITableViewCell {
lazy var nameLabel: UILabel = {
let nameLabel = UILabel.init()
nameLabel.textColor = .black
nameLabel.font = BoldFont_16_Fit
nameLabel.backgroundColor = .clear
nameLabel.text = "我的身份"
return nameLabel
}()
lazy var headerView: UIImageView = {
let headerView = UIImageView.init()
headerView.image = UIImage(named: "mine_header_icon_identity")
headerView.backgroundColor = .clear
headerView.contentMode = .scaleToFill
return headerView
}()
lazy var mainView: UIView = {
let mainView = UIView.init()
mainView.backgroundColor = .white
mainView.layer.cornerRadius = 8
mainView.layer.masksToBounds = true
return mainView
}()
lazy var lookBtn: UIButton = {
let lookBtn = UIButton.init(type: .custom)
lookBtn.setTitle(" 去看看 ", for: .normal)
lookBtn.setTitleColor(.white, for: .normal)
lookBtn.titleLabel?.font = BoldFont_14
lookBtn.layer.masksToBounds = true
lookBtn.layer.cornerRadius = 15
return lookBtn
}()
lazy var tipLabel: UILabel = {
let tipLabel = UILabel.init()
tipLabel.textColor = HexColor("#999999")
tipLabel.text = "您暂未进行身份认证"
tipLabel.font = Font_13
return tipLabel
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.selectionStyle = .none
self.backgroundColor = .clear
addSubview(mainView)
mainView.addSubview(headerView)
headerView.addSubview(nameLabel)
mainView.addSubview(tipLabel)
mainView.addSubview(lookBtn)
setupConstraints()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setupConstraints() {
mainView.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.left.equalToSuperview().offset(15)
make.right.equalToSuperview().offset(-15)
make.top.bottom.equalToSuperview()
}
headerView.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.top.left.right.equalToSuperview()
make.height.equalTo(40)
}
nameLabel.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.left.equalToSuperview().offset(15)
}
tipLabel.snp.makeConstraints { make in
make.centerY.equalToSuperview().offset(20)
make.left.equalToSuperview().offset(15)
}
lookBtn.snp.makeConstraints { make in
make.centerY.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-15)
make.width.equalTo(80)
make.height.equalTo(30)
}
lookBtn.setGradient(colors: [UIColor(red: 103/255.0, green: 197/255.0, blue: 255/255.0, alpha: 1),UIColor(red: 96/255.0, green: 154/255.0, blue: 255/255.0, alpha: 1)], startPoint: CGPoint(x: 0, y: 0.5), endPoint: CGPoint(x: 1, y: 0.5))
}
}
class MineBodyTwoListViewCell : UITableViewCell {
lazy var mainView: UIView = {
let mainView = UIView.init()
mainView.backgroundColor = .white
mainView.layer.cornerRadius = 8
mainView.layer.masksToBounds = true
return mainView
}()
lazy var nameLabel: UILabel = {
let nameLabel = UILabel.init()
nameLabel.textColor = .black
nameLabel.font = BoldFont_16_Fit
nameLabel.backgroundColor = .clear
return nameLabel
}()
lazy var headerView: UIImageView = {
let headerView = UIImageView.init()
headerView.backgroundColor = .clear
headerView.contentMode = .scaleToFill
return headerView
}()
lazy var moreBtn: UIButton = {
let moreBtn = UIButton.init(type: .custom)
moreBtn.setImage(UIImage(named: "mine_list_icon_right_more"), for: .normal)
moreBtn.layer.masksToBounds = true
moreBtn.layer.cornerRadius = 15
return moreBtn
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.selectionStyle = .none
self.backgroundColor = .clear
addSubview(mainView)
mainView.addSubview(headerView)
headerView.addSubview(nameLabel)
mainView.addSubview(moreBtn)
setupConstraints()
}
private func setupConstraints() {
mainView.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.left.equalToSuperview().offset(15)
make.right.equalToSuperview().offset(-15)
make.top.bottom.equalToSuperview()
}
headerView.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.left.equalTo(15)
make.size.equalTo(20)
}
nameLabel.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.left.equalTo(headerView.snp.right).offset(7)
}
moreBtn.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.right.equalToSuperview().offset(-15)
make.size.equalTo(30)
}
}
public func setupWithDataSource(dict : Dictionary<String, Any>) {
headerView.image = UIImage(named: dict["icon"] as! String)
nameLabel.text = "\(dict["name"] ?? "")"
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}