CNLiveHomeFollowCell.swift
3.49 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
//
// CNLiveHomeFollowCell.swift
// metaCode
//
// Created by zx on 2025/2/21.
//
import Foundation
class CNLiveHomeFollowCell:UITableViewCell{
//CNLiveHomeFollowModel
var _followModel : CNLiveHomeFollowModel?
var followModel : CNLiveHomeFollowModel? {
get{
_followModel
}
set{
_followModel = newValue!
self.setupNewUI(model: followModel!)
}
}
//MARK: - 懒加载
lazy var followImgView :UIImageView = {
let iconImgView = UIImageView(frame: CGRect(x: 15, y: 0, width: KSreenWidth-30, height: 50))
iconImgView.backgroundColor = HexColor("#FAFAFA")
iconImgView.layer.cornerRadius = 25
iconImgView.clipsToBounds = true
iconImgView.contentMode = .scaleAspectFill
iconImgView.isUserInteractionEnabled = true
iconImgView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(followImgViewAction)))
iconImgView.addSubview(followIconImgView)
iconImgView.addSubview(titleLabel)
iconImgView.addSubview(titleLabel1)
iconImgView.addSubview(subTitleLabel1)
return iconImgView
}()
lazy var followIconImgView :UIImageView = {
let iconImgView = UIImageView(frame: CGRect(x: 20, y: (50-30.0)*0.5, width: 30, height: 30))
iconImgView.image = UIImage(named: "home_followIcon")
iconImgView.contentMode = .scaleAspectFill
return iconImgView
}()
lazy var titleLabel: UILabel = {
let titleLbl = UILabel(frame: CGRect(x: followIconImgView.right+3, y: 12.5, width: 44, height: 20))
titleLbl.centerY = followIconImgView.centerY
titleLbl.font = Font_14
titleLbl.textColor = HexColor("#4A4A4A")
titleLbl.text = "正在追"
return titleLbl
}()
lazy var titleLabel1: UILabel = {
let titleLbl = UILabel(frame: CGRect(x: titleLabel.right+20, y: 5, width: KSreenWidth-titleLabel.right-20-20, height: 20))
titleLbl.font = BoldFont_14
titleLbl.textColor = HexColor("#4A4A4A")
return titleLbl
}()
lazy var subTitleLabel1: UILabel = {
let titleLbl = UILabel(frame: CGRect(x: titleLabel1.left, y: titleLabel1.bottom+5, width: titleLabel1.width, height: 14))
titleLbl.font = Font_10
titleLbl.textColor = HexColor("#999999")
return titleLbl
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.selectionStyle = .none
setupUI()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setupUI() {
contentView.backgroundColor = .clear
self.backgroundColor = .clear
self.contentView.addSubview(self.followImgView)
self.contentView.clipsToBounds = true
}
func setupNewUI(model:CNLiveHomeFollowModel){
titleLabel1.text = model.title
subTitleLabel1.text = model.description
}
@objc func followImgViewAction(){
CNLiveDownSlideTool.pushWebAndVodVCWithContentsMdl(model: self.followModel?.modelId ?? "", contentId: self.followModel?.contentId ?? "", pid: self.followModel?.activeId ?? "", shareUrl: self.followModel?.shareUrl ?? "", thirdUrl: "", title: self.followModel?.title ?? "", s_to: "", trailerId: "", controller: navigationViewController().visibleViewController, slideModel: nil)
}
}