Netease-Music-Demo/wyy/SideBar/SideBarCell.swift

66 lines
1.8 KiB
Swift
Raw Normal View History

2021-03-06 18:45:01 +08:00
//
// 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
}
}