CNCertificationView.swift
2.24 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
//
// CNCertificationView.swift
// metaCode
//
// Created by daojian on 2023/6/12.
//
import Foundation
///身份认证View
class CNCertificationView : UIView{
///添加身份点击事件回调
var addCertificationAction: closeBlock?
lazy var contentView: UIView = {
let W = self.width-50
let H = W*1.5
let contentView = UIView.init(frame: CGRect(x: 25, y: KSreenHeight*0.16, width: W, height: H ))
contentView.backgroundColor = UIColor.white
contentView.clipsToBounds = true
contentView.layer.cornerRadius = 20
return contentView
}()
///添加身份认证按钮
lazy var addCerBtn: UIButton = {
let addCerBtn = UIButton(type: .custom)
addCerBtn.frame = CGRect(x: 0, y: 0, width: 145, height: 141)
addCerBtn.centerX = self.contentView.width/2
addCerBtn.centerY = self.contentView.height/2
addCerBtn.setImage(UIImage(named: "homePage_addCertification_icon"), for: .normal)
addCerBtn.addTarget(self, action: #selector(addCerBtnAction), for: .touchUpInside)
return addCerBtn
}()
///添加身份按钮底部标题
lazy var addCerBtnBottomTitle: UILabel = {
let addCerBtnBottomTitle = UILabel(frame: CGRect(x: 0, y: self.addCerBtn.bottom - 10, width: 100, height: 22))
addCerBtnBottomTitle.centerX = self.addCerBtn.centerX
addCerBtnBottomTitle.textColor = UIColor("#0066FE")
addCerBtnBottomTitle.textAlignment = .center
addCerBtnBottomTitle.font = UIFont.systemFont(ofSize: 15, weight: .regular)
addCerBtnBottomTitle.text = "身份认证"
return addCerBtnBottomTitle
}()
override init(frame: CGRect) {
super.init(frame: frame)
self.initUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func initUI()
{
self.addSubview(self.contentView)
self.contentView.addSubview(self.addCerBtn)
self.contentView.addSubview(self.addCerBtnBottomTitle)
}
@objc func addCerBtnAction(){
if(self.addCertificationAction != nil){
self.addCertificationAction!()
}
}
}