66 lines
1.8 KiB
Swift
66 lines
1.8 KiB
Swift
|
//
|
||
|
// SideBarCell.swift
|
||
|
// wyy
|
||
|
//
|
||
|
// Created by 施书顺 on 2021/3/6.
|
||
|
//
|
||
|
|
||
|
import UIKit
|
||
|
import SnapKit
|
||
|
|
||
|
class SideBarCell: UITableViewCell {
|
||
|
|
||
|
let iconRadius: CGFloat = 10
|
||
|
|
||
|
let iconImageView = UIImageView()
|
||
|
let titleLabel = UILabel()
|
||
|
let continueLabel = UILabel()
|
||
|
|
||
|
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||
|
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||
|
|
||
|
contentView.addSubview(iconImageView)
|
||
|
iconImageView.contentMode = .scaleAspectFit
|
||
|
iconImageView.snp.makeConstraints{ make in
|
||
|
make.width.equalTo(iconRadius * 2)
|
||
|
make.height.equalTo(iconRadius * 2)
|
||
|
make.left.equalTo(10)
|
||
|
make.centerY.equalToSuperview()
|
||
|
}
|
||
|
|
||
|
contentView.addSubview(titleLabel)
|
||
|
titleLabel.textColor = .black
|
||
|
titleLabel.font = UIFont.systemFont(ofSize: 10)
|
||
|
titleLabel.textAlignment = .left
|
||
|
titleLabel.snp.makeConstraints{ make in
|
||
|
make.left.equalTo(iconImageView.snp.right).offset(10)
|
||
|
make.centerY.equalToSuperview()
|
||
|
}
|
||
|
|
||
|
contentView.addSubview(continueLabel)
|
||
|
continueLabel.text = ">"
|
||
|
continueLabel.textColor = .black
|
||
|
continueLabel.font = UIFont.systemFont(ofSize: 10, weight: .light)
|
||
|
continueLabel.snp.makeConstraints{ make in
|
||
|
make.right.equalTo(10)
|
||
|
make.centerY.equalToSuperview()
|
||
|
}
|
||
|
}
|
||
|
|
||
|
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
|
||
|
}
|
||
|
|
||
|
}
|