123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- //
- // CommonDataView.swift
- // xingchuangke
- //
- // Created by 李晓飞 on 2020/8/13.
- // Copyright © 2020 Virgil. All rights reserved.
- //
- import UIKit
- class CommonDataView: UIView {
- lazy var bgImgV: UIImageView = {
- let imgV = UIImageView.init(image: UIImage(named: "img_card_banner_07"))
- imgV.isUserInteractionEnabled = true
- return imgV
- }()
- lazy var earnTitLbl: UILabel = {
- let lbl = UILabel.init()
- lbl.text = "总额"
- lbl.textColor = UIColor.white
- return lbl
- }()
- lazy var earnLbl: UILabel = {
- let lbl = UILabel.init()
- lbl.text = "0.00"
- lbl.textColor = UIColor.white
- return lbl
- }()
- lazy var rewardTitLbl: UILabel = {
- let lbl = UILabel.init()
- lbl.text = "奖励"
- lbl.textColor = UIColor.white
- lbl.textAlignment = .right
- return lbl
- }()
- lazy var rewardLbl: UILabel = {
- let lbl = UILabel.init()
- lbl.text = "0.00"
- lbl.textColor = UIColor.white
- lbl.textAlignment = .right
- return lbl
- }()
- lazy var rewardControl: UIControl = {
- let btn = UIControl.init()
- btn.isUserInteractionEnabled = true
- return btn
- }()
-
- override init(frame: CGRect) {
- super.init(frame: frame)
- setupUI()
- }
- required init?(coder: NSCoder) {
- fatalError("init(coder:) has not been implemented")
- }
- func setupUI() {
- self.addSubview(bgImgV)
- bgImgV.addSubview(earnTitLbl)
- bgImgV.addSubview(earnLbl)
- bgImgV.addSubview(rewardTitLbl)
- bgImgV.addSubview(rewardLbl)
- bgImgV.addSubview(rewardControl)
- let w = self.frame.width
- let h = self.frame.height
- bgImgV.setOrigin(x: 0, y: 0)
- bgImgV.setSize(width: w, height: h)
- bgImgV.layer.cornerRadius = 10
- bgImgV.layer.masksToBounds = true
- earnTitLbl.setOrigin(x: 20, y: 50)
- earnTitLbl.setSizeHeight(height: 30)
- earnTitLbl.setSizeWidth(width: 150)
- earnLbl.setOrigin(x: 20, y: 80)
- earnLbl.setSizeHeight(height: 30)
- earnLbl.setSizeWidth(width: 150)
- rewardTitLbl.setOrigin(x: w - 170, y: 50)
- rewardTitLbl.setSizeHeight(height: 30)
- rewardTitLbl.setSizeWidth(width: 150)
- rewardLbl.setOrigin(x: w - 170, y: 80)
- rewardLbl.setSizeHeight(height: 30)
- rewardLbl.setSizeWidth(width: 150)
- rewardControl.setOrigin(x: 0, y: 0)
- rewardControl.setSize(width: w, height: h)
- }
- /*
- // Only override draw() if you perform custom drawing.
- // An empty implementation adversely affects performance during animation.
- override func draw(_ rect: CGRect) {
- // Drawing code
- }
- */
- }
|