CNLiveShopClassifyInputTableViewCell.swift
2.98 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
//
// CNLiveShopClassifyInputTableViewCell.swift
// metaCode
//
// Created by zx on 2023/11/18.
//
import Foundation
class CNLiveShopClassifyInputTableViewCell:UITableViewCell{
// MARK: - Lazy
lazy var titlelab: UILabel = {
let titlelab = UILabel.init()
titlelab.textColor = HexColor("#333333")
titlelab.textAlignment = .left
titlelab.font = Font_14
titlelab.adjustsFontSizeToFitWidth=true
return titlelab
}()
lazy var star: UILabel = {
let star = UILabel.init(frame: CGRect(x: 5, y: 0, width: 6, height: 50))
star.textColor = HexColor("#FF725C")
star.textAlignment = .left
star.text = "*"
star.font = Font_12
return star
}()
lazy var textFiled :UITextField = {
let textFiled = UITextField()
textFiled.textAlignment = .right
textFiled.font = Font_14
return textFiled
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.selectionStyle = .none
self.initUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func initUI(){
self.contentView.addSubview(self.titlelab)
self.contentView.addSubview(self.star)
self.contentView.addSubview(self.textFiled)
self.p_massony()
}
func p_massony(){
self.titlelab.snp.makeConstraints { make in
make.left.equalTo(15)
make.centerY.equalTo(self.contentView.centerY)
}
self.titlelab.setContentCompressionResistancePriority(.required, for: .horizontal)
self.textFiled.snp.makeConstraints { make in
make.left.equalTo(self.titlelab.right).offset(15)
make.centerY.equalTo(self.contentView.centerY)
make.right.equalTo(self.contentView.right).offset(-15)
make.height.equalTo(50)
}
}
}
///输入标题cell
class CNLiveShopClassifyInputTitleCell:CNLiveShopClassifyInputTableViewCell{
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.titlelab.text = "分类名称"
self.textFiled.placeholder = "请输入分类名称"
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
///输入排序cell
class CNLiveShopClassifyInputSortCell:CNLiveShopClassifyInputTableViewCell{
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.selectionStyle = .none
self.titlelab.text = "排序"
self.textFiled.placeholder = "请输入排序"
self.textFiled.keyboardType = .numberPad
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}