CNLiveMineHeaderView.swift
2.04 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
//
// CNLiveMineHeaderView.swift
// metaCode
//
// Created by open on 2023/6/7.
//
import Foundation
class MineHeaderView : UIView {
lazy var iconView : UIImageView = {
let iconView = UIImageView.init()
iconView.image = UIImage(named: "mine_header_icon_defult_ava")
iconView.backgroundColor = .clear
iconView.layer.cornerRadius = 20
iconView.layer.masksToBounds = true
iconView.contentMode = .scaleToFill
return iconView
}()
lazy var nameLabel: UILabel = {
let nameLabel = UILabel.init()
nameLabel.text = UserInfoManager.shared.userInfo.nickName
nameLabel.textColor = .white
nameLabel.font = Font_16
return nameLabel
}()
lazy var tipBtn: UIButton = {
let tipBtn = UIButton(type: .custom)
tipBtn.backgroundColor = .clear
tipBtn.setImage(UIImage(named: "mine_header_icon_notice"), for: .normal)
tipBtn.imageView?.contentMode = .scaleToFill
tipBtn.addTarget(self, action: #selector(tipBtnAction), for: .touchUpInside)
return tipBtn
}()
override init(frame: CGRect) {
super.init(frame: frame)
self.backgroundColor = .clear
addSubview(iconView)
iconView.snp.makeConstraints { make in
make.centerY.equalToSuperview().offset(10)
make.left.equalToSuperview().offset(20)
make.size.equalTo(60)
}
addSubview(nameLabel)
nameLabel.snp.makeConstraints { make in
make.centerY.equalToSuperview().offset(10)
make.left.equalTo(iconView.snp.right).offset(15)
}
addSubview(tipBtn)
tipBtn.snp.makeConstraints { make in
make.centerY.equalToSuperview().offset(10)
make.right.equalToSuperview().offset(-15)
make.size.equalTo(30)
}
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
@objc func tipBtnAction() {
}
}