CNLiveMineBodyListView.swift
25.4 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
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
//
// 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.isUserInteractionEnabled = false
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 = 15
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 avatarView: UIImageView = {
let avatarView = UIImageView.init()
avatarView.backgroundColor = .clear
avatarView.contentMode = .scaleAspectFill
avatarView.layer.cornerRadius = 30
avatarView.layer.masksToBounds = true
avatarView.clipsToBounds = true
avatarView.isHidden = true
return avatarView
}()
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
}()
lazy var descLabel: UILabel = {
let descLabel = UILabel.init()
descLabel.textColor = HexColor("#999999")
descLabel.font = Font_11_Fit
descLabel.backgroundColor = .white
descLabel.isHidden = true
return descLabel
}()
lazy var moreLabel: UILabel = {
let moreLabel = UILabel.init()
moreLabel.textColor = HexColor("#999999")
moreLabel.font = Font_11_Fit
moreLabel.textAlignment = .right
moreLabel.backgroundColor = .white
moreLabel.isHidden = true
return moreLabel
}()
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)
mainView.addSubview(descLabel)
mainView.addSubview(moreLabel)
mainView.addSubview(avatarView)
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.equalTo(mainView)
make.left.equalTo(15)
make.size.equalTo(20)
}
nameLabel.snp.makeConstraints { make in
make.centerY.equalTo(headerView)
make.left.equalTo(headerView.snp.right).offset(7)
}
moreBtn.snp.makeConstraints { make in
make.centerY.equalTo(headerView)
make.right.equalToSuperview().offset(-15)
make.height.equalTo(30)
make.width.equalTo(15)
}
descLabel.snp.makeConstraints { make in
make.centerY.equalToSuperview().offset(15)
make.left.equalTo(headerView.snp.right).offset(7)
}
moreLabel.snp.makeConstraints { make in
make.centerY.equalTo(headerView)
make.right.equalTo(moreBtn.snp.left)
}
avatarView.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.right.equalTo(moreBtn.snp.left).offset(-10)
make.size.equalTo(60)
}
}
public func setupWithDataSource(show_type: ListShowType,dict : Dictionary<String, Any>) {
let image = dict["icon"] as! String
if image == "" {
headerView.snp.updateConstraints { make in
make.centerY.equalToSuperview()
make.left.equalTo(15)
make.size.equalTo(0.01)
}
}else {
headerView.image = UIImage(named: image)
}
if dict.keys.contains("desc") {
descLabel.isHidden = false
descLabel.text = "\(dict["desc"] ?? "")"
headerView.snp.updateConstraints { make in
make.centerY.equalTo(mainView).offset(-10)
make.left.equalTo(15)
make.size.equalTo(20)
}
}
if dict.keys.contains("more") {
moreLabel.isHidden = false
if show_type == .info {
moreLabel.font = Font_15_Fit
}
var more = "\(dict["more"] ?? "")"
if (more == "m") {
more = "男"
}
if (more == "f") {
more = "女"
}
moreLabel.text = more
}
if (dict.keys.contains("avatar") && (dict["avatar"] as! String).count > 0) {
avatarView.isHidden = false
avatarView.kf.setImage(with: URL(string: "\(dict["avatar"] ?? "")"), placeholder: UIImage(named: "mine_header_icon_defult_ava"))
}
nameLabel.text = "\(dict["name"] ?? "")"
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
class MineBodyThreeViewCell: UITableViewCell {
lazy var mainView: UIImageView = {
let mainView = UIImageView.init()
mainView.backgroundColor = .clear
mainView.contentMode = .scaleToFill
mainView.image = UIImage(named: "mine_header_point_back")
return mainView
}()
lazy var moreView : UIImageView = {
let moreView = UIImageView.init()
moreView.image = UIImage(named: "mine_header_message_glod_more")
moreView.contentMode = .scaleToFill
moreView.backgroundColor = .clear
return moreView
}()
lazy var pointButton: UIButton = {
let pointButton = UIButton.init(type: .custom)
pointButton.backgroundColor = .clear
pointButton.setTitle(" 去赚积分", for: .normal)
pointButton.titleLabel?.font = Font_12
pointButton.imageView?.contentMode = .scaleToFill
pointButton.setTitleColor(HexColor("#FFE4C4"), for: .normal)
pointButton.setImage(UIImage(named: "mine_header_point_gold_coin"), for: .normal)
return pointButton
}()
lazy var questLabel: UILabel = {
let questLabel = UILabel.init()
questLabel.text = "做任务领积分"
questLabel.font = BoldFont_19_Fit
questLabel.textAlignment = .left
questLabel.textColor = HexColor("#FFE4C4")
return questLabel
}()
lazy var line_left_label: UILabel = {
let lineLabel = UILabel.init()
lineLabel.backgroundColor = HexColor("#FFDAB0")
return lineLabel
}()
lazy var line_right_label: UILabel = {
let rightLabel = UILabel.init()
rightLabel.backgroundColor = HexColor("#FFDAB0")
return rightLabel
}()
lazy var balanceLabel: UILabel = {
let balanceLabel = UILabel.init()
balanceLabel.text = "元码余额(元)"
balanceLabel.textColor = HexColor("#FFE4C4")
balanceLabel.font = Font_12
balanceLabel.textAlignment = .left
return balanceLabel
}()
lazy var balanceNumberLabel: UILabel = {
let balanceNumberLabel = UILabel.init()
balanceNumberLabel.text = "2130"
balanceNumberLabel.font = BoldFont_19_Fit
balanceNumberLabel.textAlignment = .left
balanceNumberLabel.textColor = HexColor("#FFE4C4")
return balanceNumberLabel
}()
lazy var pointLabel: UILabel = {
let pointLabel = UILabel.init()
pointLabel.text = "积分"
pointLabel.textColor = HexColor("#FFE4C4")
pointLabel.font = Font_12
pointLabel.textAlignment = .left
return pointLabel
}()
lazy var pointNumberLabel: UILabel = {
let pointNumberLabel = UILabel.init()
pointNumberLabel.text = "10.28W"
pointNumberLabel.font = BoldFont_19_Fit
pointNumberLabel.textAlignment = .left
pointNumberLabel.textColor = HexColor("#FFE4C4")
return pointNumberLabel
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.selectionStyle = .none
self.backgroundColor = .clear
addSubview(mainView)
mainView.addSubview(moreView)
mainView.addSubview(pointButton)
mainView.addSubview(questLabel)
mainView.addSubview(line_left_label)
mainView.addSubview(balanceLabel)
mainView.addSubview(balanceNumberLabel)
mainView.addSubview(line_right_label)
mainView.addSubview(pointLabel)
mainView.addSubview(pointNumberLabel)
setupConstraints()
}
func setupConstraints() {
mainView.snp.makeConstraints { make in
make.center.equalToSuperview()
make.left.equalToSuperview().offset(10)
make.right.equalToSuperview().offset(-10)
make.top.bottom.equalToSuperview()
}
pointButton.snp.makeConstraints { make in
make.top.equalToSuperview().offset(15)
make.left.equalToSuperview().offset(10)
make.width.equalTo(75)
}
moreView.snp.makeConstraints { make in
make.centerY.equalTo(pointButton)
make.left.equalTo(pointButton.snp.right)
}
questLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(10)
make.centerY.equalToSuperview().offset(10)
}
line_left_label.snp.makeConstraints { make in
make.left.equalTo(questLabel.snp.right).offset(10)
make.centerY.equalToSuperview()
make.height.equalTo(40)
make.width.equalTo(0.5)
}
balanceLabel.snp.makeConstraints { make in
make.centerY.equalTo(pointButton)
make.left.equalTo(line_left_label.snp.right).offset(10)
make.top.equalToSuperview().offset(15)
}
balanceNumberLabel.snp.makeConstraints { make in
make.left.equalTo(line_left_label.snp.right).offset(10)
make.centerY.equalToSuperview().offset(10)
}
line_right_label.snp.makeConstraints { make in
make.left.equalTo(balanceLabel.snp.right).offset(10)
make.centerY.equalToSuperview()
make.height.equalTo(40)
make.width.equalTo(0.5)
}
pointLabel.snp.makeConstraints { make in
make.centerY.equalTo(balanceLabel)
make.left.equalTo(line_right_label.snp.right).offset(10)
}
pointNumberLabel.snp.makeConstraints { make in
make.centerY.equalTo(balanceNumberLabel)
make.left.equalTo(line_right_label.snp.right).offset(10)
}
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
class MineBodyFourViewCell: UITableViewCell {
lazy var mainView: UIView = {
let mainView = UIView.init()
mainView.backgroundColor = .white
return mainView
}()
lazy var iconView: UIImageView = {
let iconView = UIImageView.init()
iconView.backgroundColor = .white
iconView.contentMode = .scaleToFill
iconView.image = UIImage.imageWithColor(color: HexColor("#f9f9f9")!, size: CGSizeMake(40, 40))
return iconView
}()
lazy var nameLabel: UILabel = {
let nameLabel = UILabel.init()
nameLabel.backgroundColor = .white
nameLabel.textColor = HexColor("#30364F")
nameLabel.font = Font_15_Fit
return nameLabel
}()
lazy var descLabel: UILabel = {
let descLabel = UILabel.init()
descLabel.backgroundColor = .white
descLabel.textColor = HexColor("#9EA4B8")
descLabel.font = Font_13_Fit
return descLabel
}()
lazy var shareBtn: UIButton = {
let shareBtn = UIButton.init(type: .custom)
shareBtn.frame = CGRect(x: 0, y: 0, width: 70, height: 30)
shareBtn.setTitle("去分享", for: .normal)
shareBtn.setImage(UIImage(named: "mine_list_icon_right_white_more"), for: .normal)
shareBtn.setTitleColor(.white, for: .normal)
shareBtn.titleLabel?.font = Font_12
shareBtn.setupButtonImageAndTitlePossitionWith(padding: 0, style: .right)
shareBtn.layer.cornerRadius = 15
shareBtn.layer.masksToBounds = true
return shareBtn
}()
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(nameLabel)
mainView.addSubview(descLabel)
mainView.addSubview(shareBtn)
setConstrainta()
}
func setConstrainta() {
mainView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
iconView.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.left.equalToSuperview().offset(10)
make.size.equalTo(50)
}
nameLabel.snp.makeConstraints { make in
make.top.equalTo(iconView.snp.top)
make.left.equalTo(iconView.snp.right).offset(10)
}
descLabel.snp.makeConstraints { make in
make.bottom.equalTo(iconView.snp.bottom)
make.left.equalTo(iconView.snp.right).offset(10)
}
shareBtn.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.right.equalToSuperview().offset(-10)
make.width.equalTo(70)
make.height.equalTo(30)
}
shareBtn.setGradient(colors: [UIColor(red: 255/255.0, green: 168/255.0, blue: 26/255.0, alpha: 1),UIColor(red: 255/255.0, green: 210/255.0, blue: 11/255.0, alpha: 1)], startPoint: CGPoint(x: 0, y: 0.5), endPoint: CGPoint(x: 1, y: 0.5))
}
func setupWithData(dict: NSDictionary) {
iconView.image = UIImage(named: "\(dict.object(forKey: "icon") ?? "")")
nameLabel.text = "\(dict.object(forKey: "name") ?? "")"
descLabel.text = "\(dict.object(forKey: "desc") ?? "")"
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
class MIneBodyFiveViewCell: UITableViewCell {
lazy var mainView: UIView = {
let mainView = UIView.init(frame: CGRect(x: 0, y: 0, width: Int(KSreenWidth) - 40, height: 70))
mainView.backgroundColor = .white
return mainView
}()
lazy var nameLabel: UILabel = {
let nameLabel = UILabel.init()
nameLabel.text = "签到"
nameLabel.textColor = HexColor("#666666")
nameLabel.font = Font_16
nameLabel.backgroundColor = .white
return nameLabel
}()
lazy var descLabel: UILabel = {
let descLabel = UILabel.init()
descLabel.text = "2013-01-23"
descLabel.textColor = HexColor("#999999")
descLabel.font = Font_12
descLabel.backgroundColor = .clear
return descLabel
}()
lazy var pointLabel: UILabel = {
let pointLabel = UILabel.init()
pointLabel.text = "+1000 积分"
pointLabel.textColor = HexColor("#F5A623")
pointLabel.font = BoldFont_16_Fit
pointLabel.backgroundColor = .clear
return pointLabel
}()
lazy var line_label: UILabel = {
let lineLabel = UILabel.init()
lineLabel.backgroundColor = HexColor("#E5E5E5")
return lineLabel
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
selectionStyle = .none
backgroundColor = .clear
addSubview(mainView)
mainView.addSubview(nameLabel)
mainView.addSubview(descLabel)
mainView.addSubview(pointLabel)
mainView.addSubview(line_label)
setConstrainta()
}
func setConstrainta() {
mainView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
nameLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20)
make.top.equalToSuperview().offset(10)
}
descLabel.snp.makeConstraints { make in
make.bottom.equalToSuperview().offset(-10)
make.left.equalToSuperview().offset(20)
}
pointLabel.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.right.equalToSuperview().offset(-10)
}
line_label.snp.makeConstraints { make in
make.bottom.equalToSuperview().offset(-0.5)
make.left.equalToSuperview().offset(10)
make.right.equalToSuperview().offset(-10)
make.height.equalTo(0.5)
}
}
func setupWithDataSource(isLast: Bool) {
line_label.isHidden = isLast
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
typealias resultInputBlock = () -> Void
class MineBodyInputAuthCell: UITableViewCell, UITextFieldDelegate {
lazy var mainView: UIView = {
let mainView = UIView.init(frame: CGRect.zero)
mainView.backgroundColor = .white
return mainView
}()
lazy var nameLabel: UILabel = {
let nameLabel = UILabel.init()
nameLabel.textColor = HexColor("#333333")
nameLabel.font = BoldFont_16_Fit
nameLabel.backgroundColor = .white
return nameLabel
}()
lazy var contentField: UITextField = {
let contentField = UITextField.init()
contentField.backgroundColor = .white
contentField.font = BoldFont_15_Fit
contentField.textColor = HexColor("#333333")
contentField.clearButtonMode = .whileEditing
contentField.textAlignment = .right
contentField.delegate = self
return contentField
}()
lazy var moreBtn: UIButton = {
let moreBtn = UIButton.init(type: .custom)
moreBtn.setImage(UIImage(named: "mine_header_message_gray_more"), for: .normal)
moreBtn.layer.masksToBounds = true
moreBtn.layer.cornerRadius = 15
moreBtn.isHidden = true
return moreBtn
}()
lazy var line_label: UILabel = {
let lineLabel = UILabel.init()
lineLabel.backgroundColor = HexColor("#f3f3f3")
return lineLabel
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
selectionStyle = .none
backgroundColor = .clear
addSubview(mainView)
mainView.addSubview(nameLabel)
mainView.addSubview(moreBtn)
mainView.addSubview(contentField)
mainView.addSubview(moreBtn)
mainView.addSubview(line_label)
setConstrainta()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func contentAction() {
}
fileprivate var _infoModel : MineStandInfoModel?
fileprivate var _resultInputBlock : resultInputBlock?
func setListModel(infoModel: MineStandInfoModel, is_last: Bool,resultInputBlock: @escaping resultInputBlock) {
_infoModel = infoModel
_resultInputBlock = resultInputBlock
nameLabel.text = infoModel.name
if (infoModel.value ?? "").count > 0 {
contentField.text = infoModel.value
}
contentField.placeholder = "请输入\(infoModel.name ?? "")"
line_label.isHidden = is_last
if infoModel.inputType == 2 {
contentField.keyboardType = .numberPad
} else if (infoModel.inputType == 1) {
contentField.keyboardType = .default
} else if (infoModel.inputType == 3 && infoModel.children.count > 0) {//禁止输入 显示下拉选择
contentField.isUserInteractionEnabled = false
moreBtn.isHidden = false
contentField.snp.remakeConstraints { make in
make.centerY.equalToSuperview()
make.right.equalTo(moreBtn.snp.left)
}
}
}
func setConstrainta() {
mainView.snp.makeConstraints { make in
make.top.equalToSuperview()
make.bottom.equalToSuperview()
make.left.equalToSuperview().offset(10)
make.right.equalToSuperview().offset(-10)
}
nameLabel.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.left.equalToSuperview().offset(15)
}
moreBtn.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.right.equalToSuperview().offset(-8)
}
contentField.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.right.equalToSuperview().offset(-10)
}
moreBtn.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.right.equalToSuperview().offset(-5)
}
line_label.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.bottom.equalToSuperview().offset(-1)
make.width.equalTo(Int(KSreenWidth) - 40)
make.height.equalTo(0.5)
}
}
func textFieldShouldEndEditing(_ textField: UITextField) -> Bool {
return contentField.resignFirstResponder()
}
func textFieldDidEndEditing(_ textField: UITextField) {
_infoModel?.value = textField.text ?? ""
_resultInputBlock!()
}
}