CNLiveVodPayView.swift
2.79 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
//
// CNLiveVodPayView.swift
// metaCode
//
// Created by zx on 2025/4/1.
// 支付页面
import Foundation
typealias CNLiveVodPayViewPayBlock = ()->Void
class CNLiveVodPayView:UIView{
var payBlock:CNLiveVodPayViewPayBlock?
//MARK: - 懒加载
lazy var titleLabel: UILabel = {
let titleLbl = UILabel()
titleLbl.font = Font_12
titleLbl.textColor = HexColor("#FFFFFF")
titleLbl.text = "应版权方要求,本专辑所有用户均需付费"
return titleLbl
}()
lazy var payBtn: UIButton = {
let closeBtn = UIButton(type: .custom)
closeBtn.backgroundColor = HexColor("#F5A623", alpha: 0.14)
closeBtn.layer.borderColor = HexColor("#F5A623")?.cgColor
closeBtn.layer.borderWidth = 0.5
closeBtn.clipsToBounds = true
closeBtn.layer.cornerRadius = 6
closeBtn.setTitleColor(HexColor("#F5A623"), for: .normal)
closeBtn.setTitle("元购买本专辑", for: .normal)
closeBtn.titleLabel?.font = Font_12
closeBtn.addTarget(self, action: #selector(payBtnAction), for: .touchUpInside)
return closeBtn
}()
lazy var landscapeBackBtn: UIButton = {
let backBtn = UIButton.backItem(imageName: ("mine_header_icon_white_back"), target: self, action: #selector(landscapeBackBtnAction))
backBtn.frame = CGRect(x: 15, y: KStatusBarHeight, width: 60, height: 30)
return backBtn
}()
override init(frame: CGRect) {
super.init(frame: frame)
self.backgroundColor = HexColor("#000000", alpha: 0.7)
self.isUserInteractionEnabled = true
self.initUI()
self.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(tapAction)))
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func initUI(){
// self.addSubview(self.landscapeBackBtn)
self.addSubview(self.titleLabel)
self.addSubview(self.payBtn)
payBtn.snp.makeConstraints { make in
make.center.equalToSuperview()
make.width.equalTo(117)
make.height.equalTo(30)
}
titleLabel.snp.makeConstraints { make in
make.bottom.equalTo(self.payBtn.snp.top).offset(-15)
make.centerX.equalToSuperview()
}
}
@objc func payBtnAction(){
//拉起支付
self.payBlock?()
}
@objc func tapAction(){
// self.isHidden = true
}
@objc func landscapeBackBtnAction(){
let viewControllers = navigationViewController().viewControllers
if viewControllers.count > 1 {
if viewControllers.last == self {
navigationViewController().popViewController(animated: true)
}
}
}
}