1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- //
- // BankCardCel.swift
- // xingchuangke
- //
- // Created by Apple on 2020/10/23.
- // Copyright © 2020 Virgil. All rights reserved.
- //
- import UIKit
- class BankCardCel: UIView {
- var imageView = UIImageView.init()
- var titleLabel = UILabel.init()
- var tipLabel = UILabel.init()
- var btn = UIButton.init()
- override init(frame: CGRect) {
- super.init(frame: frame)
- setupSubViews()
- }
- required init?(coder: NSCoder) {
- fatalError("init(coder:) has not been implemented")
- }
- func setupSubViews() {
- self.backgroundColor = .red
- self.layer.cornerRadius = 5
- self.backgroundColor = .white
- let width = Int((kScreenWidth-40)/3)
- imageView.frame = CGRect(x: width/2-30, y: 20, width: 60, height: 60)
- self.addSubview(imageView)
- tipLabel.frame = CGRect(x: imageView.right()-30, y: 10, width: 40, height: 20)
- tipLabel.layer.cornerRadius = 5
- tipLabel.layer.masksToBounds = true
- tipLabel.backgroundColor = .red
- tipLabel.textColor = .white
- tipLabel.font = UIFont.systemFont(ofSize: 14)
- tipLabel.textAlignment = .center
- self.addSubview(tipLabel)
- titleLabel.frame = CGRect(x: 0, y: width-25, width: width, height: 20)
- titleLabel.textAlignment = .center
- self.addSubview(titleLabel)
- titleLabel.backgroundColor = .white
- btn.frame = CGRect(x: 0, y: 0, width: Int((kScreenWidth-40)/3), height: Int((kScreenWidth-40)/3))
- self.addSubview(btn)
- }
- /*
- // Only override draw() if you perform custom drawing.
- // An empty implementation adversely affects performance during animation.
- override func draw(_ rect: CGRect) {
- // Drawing code
- }
- */
- }
|