jsdw_ios/QuickLocation/Component/TextTableViewCell/TextArrowCell.swift

97 lines
2.4 KiB
Swift

//
// TextArrowCell.swift
// SHECommunity
//
// Created by Lin on 2025/1/7.
//
import UIKit
struct TextCellModel {
var title: String
var content: String?=nil
var routeUrl: String
}
/// +
class TextArrowCell: UITableViewCell {
func configure(model: TextCellModel) {
titleLab.text = model.title
contentLab.text = model.content.safeString
}
private func setupSubviews() {
contentView.addSubview(bgView)
bgView.addSubview(titleLab)
bgView.addSubview(contentLab)
bgView.addSubview(arrowIconView)
bgView.layoutChain
.top()
.edgesHorzontal(10)
.bottom(10)
titleLab.layoutChain
.edgesHorzontal(12)
.edgesVertical(15)
arrowIconView.layoutChain
.right(12)
.centerY()
contentLab.layoutChain
.rightToLeftOfView(arrowIconView)
.centerY()
}
lazy var bgView: UIView = {
let view = UIView()
view.backgroundColor = .white
view.cornerRadius = 8
return view
}()
lazy var titleLab: UILabel = {
let label = UILabel()
label.textColor = ThemeManager.shared.color.titleColor
label.font = .systemFont(ofSize: 15, weight: .regular)
return label
}()
lazy var contentLab: UILabel = {
let label = UILabel()
label.textColor = ThemeManager.shared.color.contentColor
label.font = .systemFont(ofSize: 13, weight: .regular)
return label
}()
lazy var arrowIconView: UIImageView = {
let imgView = UIImageView()
imgView.image = UIImage(named: "Common/arrow_black")
return imgView
}()
override init(style: CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
selectionStyle = .none
backgroundColor = .clear
setupSubviews()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
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
}
}