MoviaBox/ShortPlay/Class/Player/View/SPSpeedSelectedCell.swift
2025-04-17 15:40:53 +08:00

57 lines
1.5 KiB
Swift

//
// SPSpeedSelectedCell.swift
// ShortPlay
//
// Created by on 2025/4/17.
//
import UIKit
class SPSpeedSelectedCell: SPCollectionViewCell {
var model: SPSpeedModel? {
didSet {
textLabel.text = model?.formatString()
}
}
var sp_isSelected: Bool = false {
didSet {
if sp_isSelected {
self.contentView.layer.borderColor = UIColor.colorF564B6().cgColor
self.contentView.backgroundColor = .colorF56490(alpha: 0.2)
self.textLabel.textColor = .colorF564B6()
} else {
self.contentView.layer.borderColor = UIColor.clear.cgColor
self.contentView.backgroundColor = .colorFFFFFF(alpha: 0.2)
self.textLabel.textColor = .colorD2D2D2()
}
}
}
private lazy var textLabel: UILabel = {
let label = UILabel()
label.font = .fontLight(ofSize: 14)
return label
}()
override init(frame: CGRect) {
super.init(frame: frame)
self.contentView.layer.cornerRadius = 7
self.contentView.layer.masksToBounds = true
self.contentView.layer.borderWidth = 1
contentView.addSubview(textLabel)
textLabel.snp.makeConstraints { make in
make.center.equalToSuperview()
}
}
@MainActor required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}