//
|
// MineTripRedEnvelopeCell.swift
|
// OKProject
|
//
|
// Created by alvin_y on 2020/6/16.
|
// Copyright © 2020 yangwang. All rights reserved.
|
//
|
|
import UIKit
|
|
class MineTripRedEnvelopeCell: UITableViewCell {
|
|
private let image_cover: UIImageView = {
|
let imageView = UIImageView()
|
imageView.image = UIImage.init(named: "hongbao")
|
return imageView
|
}()
|
|
/// 金额
|
private var label_money: UILabel = {
|
let label = UILabel()
|
label.textColor = UIColor.color(light: UIColor.color(hexString: "#000000"), dark: UIColor.color(hexString: "#000000"))
|
label.font = Medium(font: 14)
|
return label
|
}()
|
|
|
/// 类型
|
private var label_type: UILabel = {
|
let label = UILabel()
|
label.textColor = ThemeColor
|
label.font = UIFont.systemFont(ofSize: 12)
|
return label
|
}()
|
|
|
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
setupViews()
|
defineLayouts()
|
}
|
|
required init?(coder: NSCoder) {
|
fatalError("init(coder:) has not been implemented")
|
}
|
|
|
func configure(model: SwitchCityModel){
|
label_money.text = "¥\(model.amount)"
|
label_type.text = model.name
|
}
|
|
func setupViews() {
|
contentView.addSubview(image_cover)
|
contentView.addSubview(label_money)
|
contentView.addSubview(label_type)
|
}
|
|
//MARK: - Layouts
|
func defineLayouts() {
|
image_cover.snp.makeConstraints { (make) in
|
make.centerY.equalToSuperview()
|
make.left.equalToSuperview().offset(14)
|
make.size.equalTo(CGSize(width: 26, height: 26))
|
}
|
label_money.snp.makeConstraints { (make) in
|
make.centerY.equalToSuperview()
|
make.left.equalTo(image_cover.snp.right).offset(6)
|
}
|
label_type.snp.makeConstraints { (make) in
|
make.centerY.equalToSuperview()
|
make.right.equalToSuperview().offset(-14)
|
}
|
}
|
override func awakeFromNib() {
|
super.awakeFromNib()
|
// Initialization code
|
}
|
|
override func setSelected(_ selected: Bool, animated: Bool) {
|
super.setSelected(selected, animated: animated)
|
|
// Configure the view for the selected state
|
}
|
|
}
|