68 lines
1.5 KiB
Swift
68 lines
1.5 KiB
Swift
//
|
|
// SPEpisodeCell.swift
|
|
// Thimra
|
|
//
|
|
// Created by 曾觉新 on 2025/4/16.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
class SPEpisodeCell: SPCollectionViewCell {
|
|
|
|
|
|
var videoInfoModel: SPVideoInfoModel? {
|
|
didSet {
|
|
textLabel.text = "\(videoInfoModel?.episode ?? "0")"
|
|
}
|
|
}
|
|
|
|
var sp_isSelected: Bool = false {
|
|
didSet {
|
|
if sp_isSelected {
|
|
contentView.backgroundColor = .color621C14()
|
|
contentView.layer.borderColor = UIColor.colorFF0000().cgColor
|
|
|
|
} else {
|
|
contentView.backgroundColor = .color1C1A1C()
|
|
contentView.layer.borderColor = UIColor.color1C1A1C().cgColor
|
|
}
|
|
}
|
|
}
|
|
|
|
private lazy var textLabel: UILabel = {
|
|
let label = UILabel()
|
|
label.font = .fontMedium(ofSize: 16)
|
|
label.textColor = .colorFFFFFF()
|
|
return label
|
|
}()
|
|
|
|
override init(frame: CGRect) {
|
|
super.init(frame: frame)
|
|
|
|
contentView.layer.cornerRadius = 8
|
|
contentView.layer.masksToBounds = true
|
|
contentView.layer.borderWidth = 2
|
|
|
|
|
|
_setupUI()
|
|
}
|
|
|
|
@MainActor required init?(coder: NSCoder) {
|
|
fatalError("init(coder:) has not been implemented")
|
|
}
|
|
}
|
|
|
|
extension SPEpisodeCell {
|
|
|
|
private func _setupUI() {
|
|
contentView.addSubview(textLabel)
|
|
|
|
textLabel.snp.makeConstraints { make in
|
|
make.center.equalToSuperview()
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|