CNLiveMineSubBodyListView.swift
13.7 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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
//
// 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")
}
}
class MineStandInfoTableViewCell: UITableViewCell {
lazy var mainView: UIImageView = {
let mainView = UIImageView.init()
mainView.contentMode = .scaleToFill
mainView.backgroundColor = .white
mainView.isUserInteractionEnabled = true
mainView.layer.masksToBounds = true
mainView.layer.cornerRadius = 8
mainView.clipsToBounds = true
return mainView
}()
lazy var iconView : UIImageView = {
let iconView = UIImageView.init()
iconView.contentMode = .scaleToFill
iconView.backgroundColor = .clear
iconView.layer.masksToBounds = true
iconView.layer.cornerRadius = 25
iconView.clipsToBounds = true
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 numberLabel: UILabel = {
let numberLabel = UILabel.init()
numberLabel.textColor = HexColor("#A2A7B8")
numberLabel.font = Font_12_Fit
numberLabel.backgroundColor = .clear
return numberLabel
}()
lazy var timeLabel: UILabel = {
let timeLabel = UILabel.init()
timeLabel.textColor = HexColor("#A2A7B8")
timeLabel.font = Font_12
timeLabel.backgroundColor = .clear
timeLabel.isHidden = true
return timeLabel
}()
public func setupWithDataSource(icon: String, name: String,number: String) {
iconView.image = UIImage(named: icon)
titleLabel.text = name
numberLabel.text = number
}
public func setupWithDataSource(icon: String, name: String,number: String, time: String) {
if !icon.isEmpty {
iconView.kf.setImage(with: URL(string: icon), placeholder: UIImage.imageWithColor(color: HexColor("#f9f9f9")!, size: CGSize(width: 40, height: 40)))
} else {
iconView.image = UIImage.imageWithColor(color: HexColor("#f9f9f9")!, size: CGSize(width: 40, height: 40))
}
titleLabel.text = name
numberLabel.text = number
timeLabel.text = time
timeLabel.isHidden = false
}
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(numberLabel)
mainView.addSubview(timeLabel)
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().offset(-15)
make.left.equalTo(iconView.snp.right).offset(10)
}
numberLabel.snp.makeConstraints { make in
make.centerY.equalToSuperview().offset(15)
make.left.equalTo(iconView.snp.right).offset(10)
}
timeLabel.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.right.equalToSuperview().offset(-10)
}
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
class MineFeedBackListCollectViewCell : UICollectionViewCell {
lazy var iconView: UIImageView = {
let iconView = UIImageView.init()
iconView.backgroundColor = .white
iconView.contentMode = .scaleToFill
return iconView
}()
lazy var titleLabel: UILabel = {
let titleLabel = UILabel.init()
titleLabel.font = BoldFont_16_Fit
titleLabel.textColor = .black
return titleLabel
}()
lazy var moreView: UIImageView = {
let moreView = UIImageView.init()
moreView.contentMode = .scaleToFill
moreView.backgroundColor = .white
moreView.image = UIImage(named: "mine_add_content_more_list")
return moreView
}()
override init(frame: CGRect) {
super.init(frame: frame)
self.backgroundColor = .white
self.layer.masksToBounds = true
self.layer.cornerRadius = 8
addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.centerX.equalToSuperview().offset(10)
}
addSubview(iconView)
iconView.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.right.equalTo(titleLabel.snp.left).offset(-10)
make.size.equalTo(40)
}
addSubview(moreView)
moreView.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.left.equalTo(titleLabel.snp.right).offset(5)
make.size.equalTo(10)
}
}
public func setupWithDataSource(dict: Dictionary<String, Any>) {
iconView.image = UIImage(named: (dict["image"] as? String)!)
titleLabel.text = dict["name"] as? String
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
class MessageDescTableViewCell: UITableViewCell {
lazy var timeLabel: UILabel = {
let timeLabel = UILabel.init()
timeLabel.textColor = HexColor("#9F9F9F")
timeLabel.font = Font_13
timeLabel.textAlignment = .center
return timeLabel
}()
lazy var iconView: UIImageView = {
let iconView = UIImageView.init()
iconView.backgroundColor = .white
iconView.layer.cornerRadius = 20
iconView.layer.masksToBounds = true
iconView.contentMode = .scaleToFill
iconView.image = UIImage.imageWithColor(color: .red, size: CGSizeMake(40, 40))
return iconView
}()
lazy var cView: UIView = {
let cView = UIView.init()
cView.isUserInteractionEnabled = true
cView.backgroundColor = .white
cView.layer.cornerRadius = 10
cView.layer.masksToBounds = true
return cView
}()
lazy var contentLabel: UILabel = {
let contentLabel = UILabel.init()
contentLabel.backgroundColor = .white
contentLabel.textColor = HexColor("#666666")
contentLabel.lineBreakMode = .byCharWrapping
contentLabel.numberOfLines = 0
contentLabel.font = Font_14_Fit
return contentLabel
}()
lazy var lineLabel: UILabel = {
let lineLabel = UILabel.init()
lineLabel.backgroundColor = HexColor("#EAEAEA")
return lineLabel
}()
lazy var textButton: UIButton = {
let textButton = UIButton.init(type: .custom)
textButton.setTitle("查看详情", for: .normal)
textButton.setTitleColor(HexColor("#609BFF"), for: .normal)
textButton.titleLabel?.font = Font_13
return textButton
}()
lazy var textView: UIImageView = {
let textView = UIImageView.init()
textView.image = UIImage(named: "mine_header_message_blue_more")
textView.contentMode = .scaleToFill
textView.backgroundColor = .white
return textView
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.selectionStyle = .none
self.backgroundColor = .clear
addSubview(timeLabel)
addSubview(iconView)
addSubview(cView)
cView.addSubview(contentLabel)
cView.addSubview(lineLabel)
cView.addSubview(textButton)
cView.addSubview(textView)
setConstraints()
}
func setConstraints() {
timeLabel.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.top.equalToSuperview().offset(10)
}
iconView.snp.makeConstraints { make in
make.top.equalTo(timeLabel.snp.bottom).offset(10)
make.left.equalToSuperview().offset(10)
make.size.equalTo(40)
}
cView.snp.makeConstraints { make in
make.top.equalTo(timeLabel.snp.bottom).offset(10)
make.left.equalTo(iconView.snp.right).offset(10)
make.right.equalToSuperview().offset(-30)
make.height.equalTo(0)
}
textButton.snp.makeConstraints { make in
make.bottom.equalToSuperview().offset(-10)
make.right.equalToSuperview().offset(-20)
make.height.equalTo(20)
}
textView.snp.makeConstraints { make in
make.centerY.equalTo(textButton)
make.height.equalTo(10)
make.right.equalToSuperview().offset(-10)
make.width.equalTo(5)
}
lineLabel.snp.makeConstraints { make in
make.bottom.equalTo(textButton.snp.top).offset(-10)
make.left.equalToSuperview().offset(10)
make.right.equalToSuperview().offset(-10)
make.height.equalTo(1)
}
contentLabel.snp.makeConstraints { make in
make.left.top.equalToSuperview().offset(10)
make.right.equalToSuperview().offset(-10)
make.width.equalTo(KSreenWidth - 110)
make.height.equalTo(0)
}
}
public func setupWithDataSource(listModel: NewsListModel) {
let paraph = NSMutableParagraphStyle()
paraph.lineSpacing = 10
let attributes = [NSAttributedString.Key.font:Font_16_Fit,
NSAttributedString.Key.paragraphStyle: paraph]
contentLabel.attributedText = NSAttributedString(string: listModel.content, attributes: attributes)
timeLabel.text = listModel.timeString
if listModel.poster.isEmpty {
iconView.image = UIImage.imageWithColor(color: .red, size: CGSizeMake(40, 40))
} else {
iconView.kf.setImage(with: URL(string: listModel.poster), placeholder: UIImage.imageWithColor(color: .red, size: CGSizeMake(40, 40)))
}
cView.snp.updateConstraints { make in
make.height.equalTo(listModel.textHeight + 60)
}
contentLabel.snp.updateConstraints { make in
make.height.equalTo(listModel.textHeight)
}
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}