CNCollectMoneyCodeView.swift
1.59 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
//
// CNCollectMoneyCodeView.swift
// metaCode
//
// Created by daojian on 2023/5/30.
//
import Foundation
import UIKit
import YYCategories
///收钱码View
class CNCollectMoneyCodeView:UIView{
///懒加载
lazy var contentView:UIView = {
let contentView = UIView.init(frame: CGRect(x: 0, y: 0, width: self.width, height: self.height-150))
contentView.backgroundColor = UIColor.white
let path:UIBezierPath = UIBezierPath.init(roundedRect: contentView.bounds, byRoundingCorners: [.bottomLeft, .bottomRight], cornerRadii: CGSize.init(width: 20, height: 20))
let maskLayer:CAShapeLayer = CAShapeLayer()
maskLayer.frame = contentView.bounds
maskLayer.path = path.cgPath
contentView.layer.mask = maskLayer
let imageView = UIImageView(frame: CGRect(x: 10, y: 20, width: contentView.width - 20, height: contentView.height - 40))
imageView.image = UIImage(named: "homePage_collectMoneyImage")
contentView.addSubview(imageView)
return contentView
}()
lazy var topView:UIView = {
let tempTopView = UIView(frame: CGRect(x:0, y:20, width: self.width - 50, height: 70))
return tempTopView
}()
override init(frame: CGRect) {
super.init(frame: frame)
self.initUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
///初始化UI
func initUI(){
self.addSubview(self.contentView)
self.addSubview(self.topView)
}
}