// // SPEpisodeCell.swift // ShortPlay // // 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 { textLabel.isHidden = sp_isSelected playImageView.isHidden = !sp_isSelected } } private lazy var textLabel: UILabel = { let label = UILabel() label.font = .fontLight(ofSize: 14) label.textColor = .colorD2D2D2() return label }() private lazy var playImageView: UIImageView = { let imageView = UIImageView(image: UIImage(named: "play_icon_01")) return imageView }() override init(frame: CGRect) { super.init(frame: frame) contentView.backgroundColor = .colorFFFFFF(alpha: 0.14) contentView.layer.cornerRadius = 7 contentView.layer.masksToBounds = true _setupUI() } @MainActor required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } } extension SPEpisodeCell { private func _setupUI() { contentView.addSubview(textLabel) contentView.addSubview(playImageView) textLabel.snp.makeConstraints { make in make.center.equalToSuperview() } playImageView.snp.makeConstraints { make in make.center.equalToSuperview() } } }