CNLiveShopClassilyIconTableViewCell.swift
3.01 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
//
// CNLiveShopClassilyIconTableViewCell.swift
// metaCode
//
// Created by zx on 2023/11/18.
//
import Foundation
///上传图片成功
typealias uploadImageViewSuceessBlock = (_ imageUrl:String)->Void
///店铺分类图标cell
class CNLiveShopClassilyIconTableViewCell: UITableViewCell {
var _selectUploadImageView:CNLiveAddGoodsSelectUploadImageView?
var selectUploadImageView:CNLiveAddGoodsSelectUploadImageView?{
get{
if _selectUploadImageView == nil{
_selectUploadImageView = CNLiveAddGoodsSelectUploadImageView()
_selectUploadImageView?.maxSelectImageCount = 1
_selectUploadImageView?.isAbleSelectVideo = false
_selectUploadImageView?.deleteImage = UIImage(named: "DS_happ_daren_dynamic_delete")
_selectUploadImageView?.endUploadImageCallBack = {
let imageUrl = self.selectUploadImageView?.getCurrentSelectImageUrls().first
self.uploadImageSuceessBlock!(imageUrl ?? "")
}
}
return _selectUploadImageView
}
set{
_selectUploadImageView = newValue
}
}
var uploadImageSuceessBlock:uploadImageViewSuceessBlock?
// MARK: - Lazy
lazy var titlelab: UILabel = {
let titlelab = UILabel.init()
titlelab.textColor = HexColor("#999999")
titlelab.textAlignment = .left
titlelab.font = Font_12
titlelab.numberOfLines = 2
var att = NSMutableAttributedString(string: "分类图标 (注:手机端专用,建议上传正方形图片 100*100)")
att.addAttribute(NSAttributedString.Key.font, value: Font_14, range: NSRange(location: 0, length: 4))
att.addAttribute(NSAttributedString.Key.foregroundColor, value: HexColor("#333333")! as UIColor, range: NSRange(location: 0, length: 4))
titlelab.attributedText = att
return titlelab
}()
lazy var star: UILabel = {
let star = UILabel.init(frame: CGRect(x: 5, y: 0, width: 6, height: 40))
star.textColor = HexColor("#FF725C")
star.textAlignment = .left
star.text = "*"
star.font = Font_12
return star
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.selectionStyle = .none
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
// MARK: - 初始化UI
func initUI(){
self.contentView.addSubview(self.titlelab)
self.contentView.addSubview(self.star)
self.contentView.addSubview(self.selectUploadImageView!)
self.p_massony()
}
func p_massony(){
self.titlelab.snp.makeConstraints { make in
make.left.equalTo(15)
make.top.equalTo(0)
make.height.equalTo(40)
}
self.selectUploadImageView?.frame = CGRect(x: 0, y: 40, width: 120, height: 120)
}
}